

def stem(word, cached=True, history=10000, **kwargs):
    ' Returns the stem of the given word: ponies => poni.\n        Note: it is often taken to be a crude error \n        that a stemming algorithm does not leave a real word after removing the stem. \n        But the purpose of stemming is to bring variant forms of a word together, \n        not to map a word onto its "paradigm" form. \n    '
    stem = word.lower()
    if (cached and (stem in cache)):
        return case_sensitive(cache[stem], f)
    if (cached and (len(cache) > history)):
        cache.clear()
    if (len(stem) <= 2):
        return case_sensitive(stem, word)
    if (stem in exceptions):
        return case_sensitive(exceptions[stem], word)
    if (stem in uninflected):
        return case_sensitive(stem, word)
    stem = upper_consonant_y(stem)
    for f in (step_1a, step_1b, step_1c, step_2, step_3, step_4, step_5a, step_5b):
        stem = f(stem)
    stem = stem.lower()
    stem = case_sensitive(stem, word)
    if cached:
        cache[word.lower()] = stem.lower()
    return stem

dataset/ETHPy150Open clips/pattern/pattern/vector/stemmer.py stem/VarMisuse@52/200 `word`->`f`