Do not add the root token to the adjacency map

This commit is contained in:
Raphaël Bournhonesque 2017-06-11 18:30:01 +02:00
parent d9c567371f
commit 4ca8a396a2

View File

@ -104,6 +104,8 @@ class DependencyTree(Tree):
for token in doc: for token in doc:
self.nodes[token.i] = token self.nodes[token.i] = token
if token.head.i != token.i:
# inverse the dependency to have an actual tree # inverse the dependency to have an actual tree
self.adjacency[token.head.i][token.i] = token.dep_ self.adjacency[token.head.i][token.i] = token.dep_