mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
* Fix dependency type bug from merged tokens
This commit is contained in:
parent
af84669306
commit
4988356cf0
|
@ -380,11 +380,11 @@ cdef class Doc:
|
||||||
# Before thinking of something simpler, beware the case where a dependency
|
# Before thinking of something simpler, beware the case where a dependency
|
||||||
# bridges over the entity. Here the alignment of the tokens changes.
|
# bridges over the entity. Here the alignment of the tokens changes.
|
||||||
span_root = span.root.i
|
span_root = span.root.i
|
||||||
|
token.dep = span.root.dep
|
||||||
for i in range(self.length):
|
for i in range(self.length):
|
||||||
self.data[i].head += i
|
self.data[i].head += i
|
||||||
# Set the head of the merged token, and its dep relation, from the Span
|
# Set the head of the merged token, and its dep relation, from the Span
|
||||||
token.head = self.data[span_root].head
|
token.head = self.data[span_root].head
|
||||||
token.dep = span.root.dep
|
|
||||||
# Adjust deps before shrinking tokens
|
# Adjust deps before shrinking tokens
|
||||||
# Tokens which point into the merged token should now point to it
|
# Tokens which point into the merged token should now point to it
|
||||||
# Subtract the offset from all tokens which point to >= end
|
# Subtract the offset from all tokens which point to >= end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user