urchade / GLiNER

Generalist and Lightweight Model for Named Entity Recognition (Extract any entity types from texts) @ NAACL 2024
https://arxiv.org/abs/2311.08526
Apache License 2.0
1.48k stars 127 forks source link

Person entity is not detected #89

Closed mkmohangb closed 5 months ago

mkmohangb commented 6 months ago

Name: gliner Version: 0.1.13

I tried the getting started colab demo notebook, but the person entities were not detected. Marius Petipa & Charles Nodier => person


from gliner import GLiNER
model = GLiNER.from_pretrained("urchade/gliner_mediumv2.1")
model.eval()

text = """
Libretto by Marius Petipa, based on the 1822 novella ``Trilby, ou Le Lutin d'Argail`` by Charles Nodier, first presented by the Ballet of the Moscow Imperial Bolshoi Theatre on January 25/February 6 (Julian/Gregorian calendar dates), 1870, in Moscow with Polina Karpakova as Trilby and Ludiia Geiten as Miranda and restaged by Petipa for the Imperial Ballet at the Imperial Bolshoi Kamenny Theatre on January 17–29, 1871 in St. Petersburg with Adèle Grantzow as Trilby and Lev Ivanov as Count Leopold.
"""

labels = ["person", "book", "location", "date", "actor", "character"]

entities = model.predict_entities(text, labels, threshold=0.4)

for entity in entities:
    print(entity["text"], "=>", entity["label"])

==============================
Trilby => character
Moscow => location
January 25/February 6 => date
1870 => date
Moscow => location
Polina Karpakova => actor
Trilby => character
Ludiia Geiten => actor
Miranda => character
January 17–29, 1871 => date
St. Petersburg => location
Adèle Grantzow => actor
Trilby => character
Lev Ivanov => actor
Count Leopold => character
urchade commented 5 months ago

Hi, performance/bias may vary across models. In this case, the types "character" and "actor" have higher probabilities so "person" is not returned