code: def _truncate(words, cutlength):
      """Group words by stems defined by truncating them at given length.
  
      :param words: Set of words used for analysis
      :param cutlength: Words are stemmed by cutting at this length.
      :type words: set(str) or list(str)
      :type cutlength: int
      :return: Dictionary where keys are stems and values are sets of words
      corresponding to that stem.
      :rtype: dict(str): set(str)
      """
      stems = {}
      for word in words:
          stem = word[:cutlength]
          try:
              stems[stem].update([word])
          except KeyError:
              stems[stem] = {word}
      return stems
  
file_path: nltk/nltk/metrics/paice.py
imports: from math import sqrt
label_desc: Use image node_id 2 for calling a global function with example usage: _truncate(words, cutlength) and returns: stems