def _truncate(words, cutlength):
 stems = {}
 for word in words:
  stem = word[:cutlength]
  try:
   stems[stem].update([word])
  except KeyError:
   stems[stem] = set([word])
 return stems

def _truncate ( words , cutlength ) : stems = { } for word in words : stem = word [ : cutlength ] try : stems [ stem ] . update ( [ word ] ) except KeyError : stems [ stem ] = set ( [ word ] ) return stems
group words by stems defined by truncating them at given length .