mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-04 11:25:51 +03:00
run isort
This commit is contained in:
parent
8b64741502
commit
b502de4691
|
@ -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.
|
||||
|
||||
|
|
|
@ -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 ##############################
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user