chunkipy.language_detectors.fasttext_language_detector

Classes

FastTextLanguageDetector(model_path[, ...])

Detect language codes using a FastText language identification model.

class chunkipy.language_detectors.fasttext_language_detector.FastTextLanguageDetector(model_path, label_prefix='__label__')[source]

Bases: BaseLanguageDetector

Detect language codes using a FastText language identification model.

The detector expects a path to a model compatible with the FastText Python bindings, such as Facebook’s lid.176.bin.

Parameters:
  • model_path (str)

  • label_prefix (str)

detect(text)[source]

Return the top predicted FastText language code for text.

Return type:

str

Parameters:

text (str)