Convert specifically from int32 to uint64

This commit is contained in:
Adriane Boyd 2022-12-07 20:00:01 +01:00
parent 02f2cc7e29
commit 0b8a94dbc1
2 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ def get_doc(
for annot in annotations:
if annot:
if annot is heads:
annot = numpy.array(heads).astype(numpy.uint64)
annot = numpy.array(heads, dtype=numpy.int32).astype(numpy.uint64)
for i in range(len(words)):
if attrs.ndim == 1:
attrs[i] = annot[i]

View File

@ -272,7 +272,7 @@ cdef class Span:
for ancestor in ancestors:
ancestor_i = ancestor.i - self.start
if ancestor_i in range(length):
array[i, head_col] = numpy.array(ancestor_i - i).astype(numpy.uint64)
array[i, head_col] = numpy.int32(ancestor_i - i).astype(numpy.uint64)
# if there is no appropriate ancestor, define a new artificial root
value = array[i, head_col]
@ -280,7 +280,7 @@ cdef class Span:
new_root = old_to_new_root.get(ancestor_i, None)
if new_root is not None:
# take the same artificial root as a previous token from the same sentence
array[i, head_col] = numpy.array(new_root - i).astype(numpy.uint64)
array[i, head_col] = numpy.int32(new_root - i).astype(numpy.uint64)
else:
# set this token as the new artificial root
array[i, head_col] = 0