import Utils # To get the FindFirst class procedure main(a) WS := " \t" showCounts := "--showcounts" == !a phrases := ["cei","cie","ei","ie"] ff := FindFirst(phrases) totals := table(0) every map(!&input) ? { w := (tab(many(WS)),tab(upto(WS))) # word (tab(many(WS)),tab(upto(WS))) # Skip part of speech n := integer((tab(many(WS)),tab(upto(WS)|0))) | next # frequency? \w ? while totals[2(tab(ff.locate()), ff.moveMatch(), move(-1))] +:= n } eiP := totals["cei"] > 2* totals["cie"] ieP := (totals["ie"]+totals["cei"]) > 2* totals["ei"] write("phrase is ",((\ieP & \eiP),"plausible")|"not plausible") write("ie is ",(\ieP,"plausible")|"not plausible") write("ei is ",(\eiP,"plausible")|"not plausible") if \showCounts then every write(phrase := !phrases,": ",totals[phrase]) end