Skip to content

Commit

Permalink
change span representation to include rank to prevent collisions from…
Browse files Browse the repository at this point in the history
… sentence ID
  • Loading branch information
MattGPT-ai committed Feb 4, 2025
1 parent 7d368ed commit da4e8f0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions flair/nn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ def evaluate(
# get the gold labels
for datapoint in batch:
for gold_label in datapoint.get_labels(gold_label_type):
#representation = f"{rank}-{sentence_id}: {gold_label.unlabeled_identifier}"
representation = str(sentence_id) + ": " + gold_label.unlabeled_identifier
representation = f"{rank}-{sentence_id}: {gold_label.unlabeled_identifier}"

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

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

# add to all_predicted_values
if representation not in all_predicted_values:
Expand Down

0 comments on commit da4e8f0

Please sign in to comment.