How to use the langdetect.detector_factory.init_factory function in langdetect

To help you get started, we’ve selected a few langdetect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github assembl / assembl / assembl / nlp / translation_service.py View on Github external
def detector_factory():
        init_factory()
        from langdetect.detector_factory import _factory as detector_factory
        return detector_factory
github h3llrais3r / Auto-Subliminal / autosubliminal / __init__.py View on Github external
def _init_langdetect():
    """
    Initialize language detection.
    """
    # Imports
    import langdetect.detector_factory
    from langdetect.detector_factory import DetectorFactory

    # Init factory (to load the profiles at startup)
    langdetect.detector_factory.init_factory()

    # Language detection algorithm is non-deterministic, we might get different results every time you run it.
    # To enforce consistent results, call following code before the first language detection
    DetectorFactory.seed = 0