GLiNER
GLiNER copied to clipboard
Output changing with little change in input text
I made a very little change in the text , I added just "." at the end. There is change in the output. Is this expected, is there something that could be done to avoid such changes in the output?
In the following example, the difference between text1 and text2 is one "." at the end.
from gliner import GLiNER
model = GLiNER.from_pretrained("urchade/gliner_large-v2.1")
labels = ["social security number","phone number","email","date","person"]
text1 = "I want to book an appointment with Dr. Sharma as soon as possible. Patient name is Lilly brand"
print(model.predict_entities(text1, labels, flat_ner=True,threshold=0.5,multi_label=False))
text2 = "I want to book an appointment with Dr. Sharma as soon as possible. Patient name is Lilly brand."
print(model.predict_entities(text2, labels, flat_ner=True,threshold=0.5,multi_label=False))
output is as follows
[{'start': 35, 'end': 45, 'text': 'Dr. Sharma', 'label': 'person', 'score': 0.7688112258911133}, {'start': 67, 'end': 74, 'text': 'Patient', 'label': 'person', 'score': 0.7124322056770325}, {'start': 83, 'end': 88, 'text': 'Lilly', 'label': 'person', 'score': 0.7817075848579407}] [{'start': 35, 'end': 45, 'text': 'Dr. Sharma', 'label': 'person', 'score': 0.7959906458854675}, {'start': 67, 'end': 74, 'text': 'Patient', 'label': 'person', 'score': 0.7569192051887512}, {'start': 83, 'end': 94, 'text': 'Lilly brand', 'label': 'person', 'score': 0.6227995753288269}]
For case 1: I see "Lilly" as person. For case 2: "Lilly brand" as person. Addition of one "." at the end could change the output like this ?