pemistahl / lingua-py

The most accurate natural language detection library for Python, suitable for short text and mixed-language text
Apache License 2.0
1.08k stars 44 forks source link

How can we make the model check the language by itself, without the need to provide a list of languages in advance? #151

Closed Alex-Songs closed 1 year ago

Alex-Songs commented 1 year ago

How can we make the model check the language by itself, without the need to provide a list of languages in advance?

xD0135 commented 1 year ago

I too was confused about that part, but after reading the documentation, it can be achieved as simple as:

>>> from lingua import LanguageDetectorBuilder, Language
>>> detector = LanguageDetectorBuilder.from_all_languages().build()
>>> detector.detect_language_of("Ben de iyiyim. Tesekkurler.")
Language.TURKISH

Remember, README is your friend 😃

Alex-Songs commented 1 year ago

@xD0135 Thanks

pemistahl commented 1 year ago

By assuming that your issue is resolved, I close it now. Please read all the documentation before opening issues. Most questions ought to be covered by the docs. Thank you.