code: def _calculate(lemmas, stems):
      """Calculate actual and maximum possible amounts of understemmed and overstemmed word pairs.
  
      :param lemmas: A dictionary where keys are lemmas and values are sets
      or lists of words corresponding to that lemma.
      :param stems: A dictionary where keys are stems and values are sets
      or lists of words corresponding to that stem.
      :type lemmas: dict(str): list(str)
      :type stems: dict(str): set(str)
      :return: Global unachieved merge total (gumt),
      global desired merge total (gdmt),
      global wrongly merged total (gwmt) and
      global desired non-merge total (gdnt).
      :rtype: tuple(float, float, float, float)
      """
  
      n = sum(len(lemmas[word]) for word in lemmas)
  
      gdmt, gdnt, gumt, gwmt = (0.0, 0.0, 0.0, 0.0)
  
      for lemma in lemmas:
          lemmacount = len(lemmas[lemma])
  
          # Desired merge total
          gdmt += lemmacount * (lemmacount - 1)
  
          # Desired non-merge total
          gdnt += lemmacount * (n - lemmacount)
  
          # For each (lemma, stem) pair with common words, count how many
          # pairs are understemmed and overstemmed.
          umt, wmt = _calculate_cut(lemmas[lemma], stems)
  
          # Add to total undesired and wrongly-merged totals
          gumt += umt
          gwmt += wmt
  
      # Each object is counted twice, so divide by two
      return (gumt / 2, gdmt / 2, gwmt / 2, gdnt / 2)
  
file_path: nltk/nltk/metrics/paice.py
imports: from math import sqrt
label_desc: Use image node_id 6 for calling a global function with example usage: _calculate(lemmas, stems) and returns: unknown,  unknown,  unknown,  unknown