class MySplitter(object): def __init__(self): self._v_splitter = HTMLWordSplitter() def __call__(self, text, stopdict, *args, **kwargs): words = self._v_splitter._split(text) def lookup(w): return stopdict.get(w, w) return filter(None, map(lookup, words))
def __init__(self): self._v_splitter = HTMLWordSplitter()