RosettaCodeData/Task/I-before-E-except-after-C/Maple/i-before-e-except-after-c.maple
2019-09-12 10:33:56 -07:00

23 lines
851 B
Text

words:= HTTP:-Get("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt"):
lst := StringTools:-Split(words[2],"\n"):
xie, cie, cei, xei := 0, 0, 0, 0:
for item in lst do
if searchtext("ie", item) <> 0 then
if searchtext("cie", item) <> 0 then
cie := cie + 1:
else
xie := xie + 1:
fi:
fi:
if searchtext("ei", item) <> 0 then
if searchtext("cei", item) <> 0 then
cei := cei + 1:
else
xei := xei + 1:
fi:
fi:
od:
p1, p2 := evalb(xie > 2*xei),evalb(cei > 2*cie);
printf("The first phrase is %s with supporting features %d, anti features %d\n", piecewise(p1, "plausible", "not plausible"), xie, xei);
printf("The seond phrase is %s with supporting features %d, anti features %d\n", piecewise(p2, "plausible", "not plausible"), cei, cie);
printf("The overall phrase is %s\n", piecewise(p1 and p2, "plausible", "not plausible")):