RosettaCodeData/Task/I-before-E-except-after-C/Langur/i-before-e-except-after-c.langur
2026-02-01 16:33:20 -08:00

24 lines
606 B
Text

val words = less(split(readfile("./data/unixdict.txt"), delim="\n"), of=1)
val print = fn*(support number, against number) {
val ratio = support / against
writeln "{{support}} / {{against}} = {{ratio : r2}}:", (ratio < 2) * " NOT", " PLAUSIBLE"
return if(ratio >= 2: 1; 0)
}
val ks = fw/ei cei ie cie/
var cnt = {:}
for w in words {
for k in ks {
cnt[k; 0] += if(k in w: 1; 0)
}
}
val support = cnt'ie - cnt'cie
val against = cnt'ei - cnt'cei
var result = print(support, against)
result += print(cnt'cei, cnt'cie)
writeln "Overall:", (result < 2) * " NOT", " PLAUSIBLE\n"