mirror of https://github.com/explosion/spaCy.git
Documentation example fix : token.head needs '==' rather than 'is'
(similar change to #1689, it seems).
This commit is contained in:
parent
c2159c77c5
commit
e4355dade2
|
@ -143,10 +143,10 @@ p
|
|||
|
||||
+code.
|
||||
doc = nlp(u'Credit and mortgage account holders must submit their requests')
|
||||
root = [token for token in doc if token.head is token][0]
|
||||
root = [token for token in doc if token.head == token][0]
|
||||
subject = list(root.lefts)[0]
|
||||
for descendant in subject.subtree:
|
||||
assert subject.is_ancestor(descendant)
|
||||
assert subject is descendant or subject.is_ancestor(descendant)
|
||||
print(descendant.text, descendant.dep_, descendant.n_lefts, descendant.n_rights,
|
||||
[ancestor.text for ancestor in descendant.ancestors])
|
||||
|
||||
|
|
Loading…
Reference in New Issue