changed 'match' to 'search' - should work now

isaac
Isaac Riley 6 years ago
parent 6aed6963fa
commit 7ac62ab66d

@ -33,7 +33,7 @@ def extract_features_from_text(text: str):
# and match it with the input text # and match it with the input text
if feature in REGEX_CONSTANTS: if feature in REGEX_CONSTANTS:
pattern = REGEX_CONSTANTS[feature] pattern = REGEX_CONSTANTS[feature]
if bool(pattern.match(text)): if bool(pattern.search(text)):
text_feature_list.append(feature) text_feature_list.append(feature)
continue continue

@ -7,7 +7,7 @@ AVG_MACRO = 'MACRO'
REGEX_CONSTANTS = { REGEX_CONSTANTS = {
# Regex for matching Acronym Patterns -> COVID-19 / SEKA / SMY2 / EAP1 / SCP16 / ASC1 / DENV-2 # Regex for matching Acronym Patterns -> COVID-19 / SEKA / SMY2 / EAP1 / SCP16 / ASC1 / DENV-2
'ACRONYM': re.compile(r"[m0-9\W]([A-Z]{2,})[s0-9\W]"), 'ACRONYM': re.compile(r"[m0-9\W^]([A-Z]{2,})[s\.,:\-$]"),
# Regex for matching Years in the text - > 1995 / 2020 / 2019 # Regex for matching Years in the text - > 1995 / 2020 / 2019
'CONTAINS_YEAR': re.compile(r"(?<=[^0-9])1[8-9][0-9]{2}(?=[^0-9$])|(?<=[^0-9])20[0-2][0-9](?=[^0-9$])"), 'CONTAINS_YEAR': re.compile(r"(?<=[^0-9])1[8-9][0-9]{2}(?=[^0-9$])|(?<=[^0-9])20[0-2][0-9](?=[^0-9$])"),

Loading…
Cancel
Save