

def profile(self, text):
    ' Create FreqDist of trigrams within text '
    from nltk import word_tokenize, FreqDist
    clean_text = self.remove_punctuation(text)
    tokens = word_tokenize(clean_text)
    fingerprint = FreqDist()
    for t in tokens:
        token_trigram_tuples = trigrams(((self._START_CHAR + tri) + self._END_CHAR))
        token_trigrams = [''.join(tri) for tri in token_trigram_tuples]
        for cur_trigram in token_trigrams:
            if (cur_trigram in fingerprint):
                fingerprint[cur_trigram] += 1
            else:
                fingerprint[cur_trigram] = 1
    return fingerprint

dataset/ETHPy150Open nltk/nltk/nltk/classify/textcat.py TextCat.profile/VarMisuse@60/97 `t`->`tri`