INNER CODE UNIT · Python

detect_language

vgrabovets/multi_rake · multi_rake/utils.py:13

def detect_language(text, proba_threshold):
    _, _, details = pycld2.detect(text)

    language_code = details[0][1]
    probability = details[0][2]

    if language_code != 'un' and probability > proba_threshold:
        return language_code


def keep_only_letters(string):
    return ' '.join(token.group() for token in LETTERS_RE.finditer(string))


def separate_words(text):
    words = []

    for word in text.split():

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…