Mimino666 / langdetect

Port of Google's language-detection library to Python.
Other
1.71k stars 196 forks source link

Can i get top 5 confidence ? #73

Closed vkunal1996 closed 4 years ago

vkunal1996 commented 4 years ago

By using detect_lang() we get a variable number of language confidence. Is there any way to get the top 5 language confidence? for a particular string?

RasmusEdvardsen commented 4 years ago

By detect_lang(), do you mean this call? https://github.com/Mimino666/langdetect/blob/d0c8e85622abe3d67e763d9377f707e51c4a7217/langdetect/detector_factory.py#L133

vkunal1996 commented 4 years ago

Yes, @RasmusEdvardsen By Any means if I can get the top 5 confidence languages. It will be helpful.

RasmusEdvardsen commented 4 years ago

From what I understand, when you call detect_langs(text), the result is a list of all languages (that has a profile), sorted by highest probability - detect_langs(spacy_object.text)[0] giving you the highest probability, and so on.

Is that not what you want, or?

vkunal1996 commented 4 years ago

Oh, I see, I thought it will return output similar to langid tool, which gives the top language with their confidence. My Question is answered. Thanks for your help.