From b502de469102215bbb9f2ee18364e6137e4d9b85 Mon Sep 17 00:00:00 2001 From: India Kerle Date: Thu, 7 Mar 2024 08:11:44 -0300 Subject: [PATCH] run isort --- spacy/pipeline/coordinationruler.py | 5 ++-- .../tests/pipeline/test_coordinationruler.py | 24 ++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/spacy/pipeline/coordinationruler.py b/spacy/pipeline/coordinationruler.py index 1b8a1d359..177fcd45a 100644 --- a/spacy/pipeline/coordinationruler.py +++ b/spacy/pipeline/coordinationruler.py @@ -36,11 +36,11 @@ def _split_doc(doc: Doc) -> bool: for child in token.head.children: if child.dep_ in ["amod", "advmod", "nmod"]: modifiers.add(child.text) - noun_modified = True + noun_modified = True for child in token.children: if child.dep_ == "conj" and child.pos_ == "ADJ": modifiers.add(child.text) - + # check if there is a conjunction in the phrase if token.pos_ == "CCONJ": has_conjunction = True @@ -57,6 +57,7 @@ def _split_doc(doc: Doc) -> bool: else: return False + def _collect_modifiers(token: Token) -> List[str]: """Collects adverbial modifiers for a given token. diff --git a/spacy/tests/pipeline/test_coordinationruler.py b/spacy/tests/pipeline/test_coordinationruler.py index eb55df326..b276f25b0 100644 --- a/spacy/tests/pipeline/test_coordinationruler.py +++ b/spacy/tests/pipeline/test_coordinationruler.py @@ -219,13 +219,13 @@ def noun_construction_case10(nlp): token.pos_ = pos token.dep_ = dep - doc[0].head = doc[4] - doc[1].head = doc[4] - doc[2].head = doc[3] - doc[3].head = doc[4] - doc[5].head = doc[4] - doc[6].head = doc[7] - doc[7].head = doc[4] + doc[0].head = doc[4] + doc[1].head = doc[4] + doc[2].head = doc[3] + doc[3].head = doc[4] + doc[5].head = doc[4] + doc[6].head = doc[7] + doc[7].head = doc[4] return doc @@ -337,12 +337,18 @@ def test_split_noun_coordination( # test 10: 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) pass + ################### test factory ##############################