Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def detector_factory():
init_factory()
from langdetect.detector_factory import _factory as detector_factory
return detector_factory
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