code: def _calculate_cut(lemmawords, stems):
      """Count understemmed and overstemmed pairs for (lemma, stem) pair with common words.
  
      :param lemmawords: Set or list of words corresponding to certain lemma.
      :param stems: A dictionary where keys are stems and values are sets
      or lists of words corresponding to that stem.
      :type lemmawords: set(str) or list(str)
      :type stems: dict(str): set(str)
      :return: Amount of understemmed and overstemmed pairs contributed by words
      existing in both lemmawords and stems.
      :rtype: tuple(float, float)
      """
      umt, wmt = 0.0, 0.0
      for stem in stems:
          cut = set(lemmawords) & set(stems[stem])
          if cut:
              cutcount = len(cut)
              stemcount = len(stems[stem])
              # Unachieved merge total
              umt += cutcount * (len(lemmawords) - cutcount)
              # Wrongly merged total
              wmt += cutcount * (stemcount - cutcount)
      return (umt, wmt)
  
file_path: nltk/nltk/metrics/paice.py
imports: from math import sqrt
label_desc: Use image node_id 5 for calling a global function with example usage: _calculate_cut(lemmawords, stems) and returns: umt,  wmt