diff --git a/scispacy/candidate_generation.py b/scispacy/candidate_generation.py index 7bcf934..00324ac 100644 --- a/scispacy/candidate_generation.py +++ b/scispacy/candidate_generation.py @@ -281,8 +281,8 @@ def nmslib_knn_with_zero_vectors( neighbors.append([]) distances.append([]) # interleave `neighbors` and Nones in `extended_neighbors` - extended_neighbors[empty_vectors_boolean_flags] = numpy.array(neighbors)[:-1] - extended_distances[empty_vectors_boolean_flags] = numpy.array(distances)[:-1] + extended_neighbors[empty_vectors_boolean_flags] = numpy.array(neighbors, dtype='object')[:-1] + extended_distances[empty_vectors_boolean_flags] = numpy.array(distances, dtype='object')[:-1] return extended_neighbors, extended_distances