

def calc_dist(self, lang, trigram, text_profile):
    ' Calculate the "out-of-place" measure between the\n            text and language profile for a single trigram '
    lang_fd = self._corpus.lang_freq(lang)
    dist = 0
    if (trigram in lang_fd):
        idx_lang_profile = list(self.keys()).index(trigram)
        idx_text = list(text_profile.keys()).index(trigram)
        dist = abs((idx_lang_profile - idx_text))
    elif PY3:
        dist = maxsize
    else:
        dist = maxint
    return dist

dataset/ETHPy150Open nltk/nltk/nltk/classify/textcat.py TextCat.calc_dist/VarMisuse@46/102 `lang_fd`->`self`