Skip to content

Commit 7734bdd

Browse files
committed
change span representation to include rank to prevent collisions from sentence ID
1 parent 4af4195 commit 7734bdd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

flair/nn/model.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ def evaluate(
338338
# get the gold labels
339339
for datapoint in batch:
340340
for gold_label in datapoint.get_labels(gold_label_type):
341-
#representation = f"{rank}-{sentence_id}: {gold_label.unlabeled_identifier}"
342-
representation = str(sentence_id) + ": " + gold_label.unlabeled_identifier
341+
representation = f"{rank}-{sentence_id}: {gold_label.unlabeled_identifier}"
343342

344343
value = gold_label.value
345344
if gold_label_dictionary and gold_label_dictionary.get_idx_for_item(value) == 0:
@@ -354,8 +353,7 @@ def evaluate(
354353
all_spans.add(representation)
355354

356355
for predicted_span in datapoint.get_labels("predicted"):
357-
#representation = f"{rank}-{sentence_id}: {predicted_span.unlabeled_identifier}"
358-
representation = str(sentence_id) + ": " + predicted_span.unlabeled_identifier
356+
representation = f"{rank}-{sentence_id}: {predicted_span.unlabeled_identifier}"
359357

360358
# add to all_predicted_values
361359
if representation not in all_predicted_values:

0 commit comments

Comments
 (0)