def _calculate_cut(lemmawords, stems):
 (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])
   umt += (cutcount * (len(lemmawords) - cutcount))
   wmt += (cutcount * (stemcount - cutcount))
 return (umt, wmt)

def _calculate_cut ( lemmawords , stems ) : ( 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 ] ) umt += ( cutcount * ( len ( lemmawords ) - cutcount ) ) wmt += ( cutcount * ( stemcount - cutcount ) ) return ( umt , wmt )
count understemmed and overstemmed pairs for pair with common words .