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