mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 10:16:27 +03:00
Initialize all values in a2b/b2a in new align (#5063)
This commit is contained in:
parent
b4e0d2bf50
commit
65d7bab10f
|
@ -151,6 +151,8 @@ def align(tokens_a, tokens_b):
|
||||||
cost = 0
|
cost = 0
|
||||||
a2b = numpy.empty(len(tokens_a), dtype="i")
|
a2b = numpy.empty(len(tokens_a), dtype="i")
|
||||||
b2a = numpy.empty(len(tokens_b), dtype="i")
|
b2a = numpy.empty(len(tokens_b), dtype="i")
|
||||||
|
a2b.fill(-1)
|
||||||
|
b2a.fill(-1)
|
||||||
a2b_multi = {}
|
a2b_multi = {}
|
||||||
b2a_multi = {}
|
b2a_multi = {}
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -160,7 +162,6 @@ def align(tokens_a, tokens_b):
|
||||||
while i < len(tokens_a) and j < len(tokens_b):
|
while i < len(tokens_a) and j < len(tokens_b):
|
||||||
a = tokens_a[i][offset_a:]
|
a = tokens_a[i][offset_a:]
|
||||||
b = tokens_b[j][offset_b:]
|
b = tokens_b[j][offset_b:]
|
||||||
a2b[i] = b2a[j] = -1
|
|
||||||
if a == b:
|
if a == b:
|
||||||
if offset_a == offset_b == 0:
|
if offset_a == offset_b == 0:
|
||||||
a2b[i] = j
|
a2b[i] = j
|
||||||
|
|
Loading…
Reference in New Issue
Block a user