This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import marisa_trie | |
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer | |
# hack to store vocabulary in MARISA Trie | |
class _MarisaVocabularyMixin(object): | |
def fit_transform(self, raw_documents, y=None): | |
super(_MarisaVocabularyMixin, self).fit_transform(raw_documents) | |
self._freeze_vocabulary() |