run isort

This commit is contained in:
India Kerle 2024-03-07 08:11:44 -03:00
parent 8b64741502
commit b502de4691
2 changed files with 18 additions and 11 deletions

View File

@ -36,11 +36,11 @@ def _split_doc(doc: Doc) -> bool:
for child in token.head.children: for child in token.head.children:
if child.dep_ in ["amod", "advmod", "nmod"]: if child.dep_ in ["amod", "advmod", "nmod"]:
modifiers.add(child.text) modifiers.add(child.text)
noun_modified = True noun_modified = True
for child in token.children: for child in token.children:
if child.dep_ == "conj" and child.pos_ == "ADJ": if child.dep_ == "conj" and child.pos_ == "ADJ":
modifiers.add(child.text) modifiers.add(child.text)
# check if there is a conjunction in the phrase # check if there is a conjunction in the phrase
if token.pos_ == "CCONJ": if token.pos_ == "CCONJ":
has_conjunction = True has_conjunction = True
@ -57,6 +57,7 @@ def _split_doc(doc: Doc) -> bool:
else: else:
return False return False
def _collect_modifiers(token: Token) -> List[str]: def _collect_modifiers(token: Token) -> List[str]:
"""Collects adverbial modifiers for a given token. """Collects adverbial modifiers for a given token.

View File

@ -219,13 +219,13 @@ def noun_construction_case10(nlp):
token.pos_ = pos token.pos_ = pos
token.dep_ = dep token.dep_ = dep
doc[0].head = doc[4] doc[0].head = doc[4]
doc[1].head = doc[4] doc[1].head = doc[4]
doc[2].head = doc[3] doc[2].head = doc[3]
doc[3].head = doc[4] doc[3].head = doc[4]
doc[5].head = doc[4] doc[5].head = doc[4]
doc[6].head = doc[7] doc[6].head = doc[7]
doc[7].head = doc[4] doc[7].head = doc[4]
return doc return doc
@ -337,12 +337,18 @@ def test_split_noun_coordination(
# test 10: # test 10:
case10_split = split_noun_coordination(noun_construction_case10) case10_split = split_noun_coordination(noun_construction_case10)
assert case10_split == ['fresh apples', 'quite sour apples', 'fresh chicken wings', 'quite sour chicken wings'] assert case10_split == [
"fresh apples",
"quite sour apples",
"fresh chicken wings",
"quite sour chicken wings",
]
# test 11: # test 11:
case11_split = split_noun_coordination(noun_construction_case11) case11_split = split_noun_coordination(noun_construction_case11)
pass pass
################### test factory ############################## ################### test factory ##############################