Closed SergheiDinu closed 5 months ago
Hi @SergheiDinu , I am not sure to understand. Could you please state it differently ?
Ah.. I mean to return confidence if it's possible.
Hi @SergheiDinu ,
It is already in library you can use below code get scores.
from gliner import GLiNER
model = GLiNER.from_pretrained("urchade/gliner_medium")
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)
# print(entities)
for entity in entities:
print(entity["text"], "=>", entity["label"],"=>", entity["score"])
I have added this into gliner spacy for v. 0.0.8
Hi,
I see as possible to return confidence from 'predict' into 'predict_entities'. That way False Positive cases could be eliminated.
Best regards Dinu Serghei