polyglot.detect package¶
Submodules¶
polyglot.detect.base module¶
Detecting languages
-
class
polyglot.detect.base.
Detector
(text, quiet=False)[source]¶ Bases:
object
Detect the language used in a snippet of text.
-
detect
(text)[source]¶ Decide which language is used to write the text.
The method tries first to detect the language with high reliability. If that is not possible, the method switches to best effort strategy.
Parameters: text (string) – A snippet of text, the longer it is the more reliable we can detect the language used to write the text.
-
quiet
= None¶ If true, exceptions will be silenced.
-
reliable
= None¶ False if the detector used Best Effort strategy in detection.
-
-
exception
polyglot.detect.base.
Error
[source]¶ Bases:
exceptions.Exception
Base exception class for this class.
-
exception
polyglot.detect.base.
UnknownLanguage
[source]¶ Bases:
polyglot.detect.base.Error
Raised if we can not detect the language of a text snippet.
polyglot.detect.langids module¶
Module contents¶
-
class
polyglot.detect.
Detector
(text, quiet=False)[source]¶ Bases:
object
Detect the language used in a snippet of text.
-
detect
(text)[source]¶ Decide which language is used to write the text.
The method tries first to detect the language with high reliability. If that is not possible, the method switches to best effort strategy.
Parameters: text (string) – A snippet of text, the longer it is the more reliable we can detect the language used to write the text.
-