mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-04 13:40:34 +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:
|
||||
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):
|
||||
return self.nodes[item]
|
||||
|
|
Loading…
Reference in New Issue
Block a user