mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-12 04:38:28 +03:00
Do not add the root token to the adjacency map
This commit is contained in:
parent
d9c567371f
commit
4ca8a396a2
|
@ -104,8 +104,10 @@ class DependencyTree(Tree):
|
||||||
|
|
||||||
for token in doc:
|
for token in doc:
|
||||||
self.nodes[token.i] = token
|
self.nodes[token.i] = token
|
||||||
# inverse the dependency to have an actual tree
|
|
||||||
self.adjacency[token.head.i][token.i] = token.dep_
|
if token.head.i != token.i:
|
||||||
|
# inverse the dependency to have an actual tree
|
||||||
|
self.adjacency[token.head.i][token.i] = token.dep_
|
||||||
|
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
return self.nodes[item]
|
return self.nodes[item]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user