Language Detector Module
anonipy.utils.language_detector
The module containing the language_detector utilities.
The language_detector module contains the LanguageDetector class, which is used to detect the language of a text.
Classes:
| Name | Description |
|---|---|
LanguageDetector | The class representing the language detector. |
anonipy.utils.language_detector.LanguageDetector
The class representing the language detector.
Examples:
>>> from anonipy.utils.language_detector import LanguageDetector
>>> detector = LanguageDetector()
>>> detector.detect(text)
Attributes:
| Name | Type | Description |
|---|---|---|
detector | LanguageDetector | The language detector. |
Methods:
| Name | Description |
|---|---|
__call__ | Detect the language of a text. Calls the |
detect | Detect the language of a text. |
Source code in anonipy/utils/language_detector.py
__init__(low_accuracy=False)
Initializes the language detector.
Examples:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
low_accuracy | bool | Whether to use the low accuracy mode. | False |
Source code in anonipy/utils/language_detector.py
__call__(text, output_standard='iso_code_639_1')
Detects the language of a text by calling the detect method.
Examples:
>>> from anonipy.utils.language_detector import LanguageDetector
>>> detector = LanguageDetector()
>>> detector(text)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | str | The text to detect the language of. | required |
output_standard | str | The output standard. | 'iso_code_639_1' |
Returns:
| Type | Description |
|---|---|
str | The language code. |
str | The full name of the language. |
Source code in anonipy/utils/language_detector.py
detect(text, output_standard='iso_code_639_1')
Detects the language of a text.
Examples:
>>> from anonipy.utils.language_detector import LanguageDetector
>>> detector = LanguageDetector()
>>> detector.detect(text)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | str | The text to detect the language of. | required |
output_standard | str | The output standard. | 'iso_code_639_1' |
Returns:
| Type | Description |
|---|---|
str | The language code. |
str | The full name of the language. |