Skip to content

Commit 5975572

Browse files
committed
Bugfix: Add prefix to name_mod_candidate feature
1 parent 79150bb commit 5975572

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ingredient_parser/en/_phrases.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def detect_phrases(self, tokenized_sentence: list[Token]) -> list[list[int]]:
119119

120120
# If first item in list is a known unit, remove it.
121121
first_idx = indices[0]
122+
# TODO: also exclude sizes e.g. large, small. Needs a list of them.
122123
if self.tokenized_sentence[first_idx].text.lower() in FLATTENED_UNITS_LIST:
123124
indices = indices[1:]
124125
# If first index is now a conjunction, skip.
@@ -167,7 +168,8 @@ def token_features(self, index: int, prefix: str) -> dict[str, str | bool]:
167168
# features[prefix + "mip_end"] = True
168169

169170
if self._candidate_name_mod(phrase, index):
170-
features["name_mod_candidate"] = True
171+
# Token is first element of first subsection of phrase.
172+
features[prefix + "name_mod_candidate"] = True
171173

172174
return features
173175

0 commit comments

Comments
 (0)