def stem(word, cached=True, history=10000, **kwargs):
 stem = word.lower()
 if (cached and (stem in cache)):
  return case_sensitive(cache[stem], word)
 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

def stem ( word , cached = True , history = 10000 , ** kwargs ) : stem = word . lower ( ) if ( cached and ( stem in cache ) ) : return case_sensitive ( cache [ stem ] , word ) 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
returns the stemmed version of the argument string .