Jump to content

I before E except after C: Difference between revisions

Added 11l
m (→‎{{header|Phix}}: added syntax colouring the hard way)
(Added 11l)
Line 32:
* [http://ucrel.lancs.ac.uk/bncfreq/ Companion website] for the book: "Word Frequencies in Written and Spoken English: based on the British National Corpus".
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>V PLAUSIBILITY_RATIO = 2
 
F plausibility_check(comment, x, y)
print("\n Checking plausibility of: #.".format(comment))
I x > :PLAUSIBILITY_RATIO * y
print(‘ PLAUSIBLE. As we have counts of #. vs #., a ratio of #2.1 times’.format(x, y, Float(x) / y))
E
I x > y
print(‘ IMPLAUSIBLE. As although we have counts of #. vs #., a ratio of #2.1 times does not make it plausible’.format(x, y, Float(x) / y))
E
print(‘ IMPLAUSIBLE, probably contra-indicated. As we have counts of #. vs #., a ratio of #2.1 times’.format(x, y, Float(x) / y))
R x > :PLAUSIBILITY_RATIO * y
 
F simple_stats()
V words = File(‘unixdict.txt’).read().split("\n")
V cie = Set(words.filter(word -> ‘cie’ C word)).len
V cei = Set(words.filter(word -> ‘cei’ C word)).len
V not_c_ie = Set(words.filter(word -> re:‘(^ie|[^c]ie)’.search(word))).len
V not_c_ei = Set(words.filter(word -> re:‘(^ei|[^c]ei)’.search(word))).len
R (cei, cie, not_c_ie, not_c_ei)
 
F print_result(cei, cie, not_c_ie, not_c_ei)
I (plausibility_check(‘I before E when not preceded by C’, not_c_ie, not_c_ei) & plausibility_check(‘E before I when preceded by C’, cei, cie))
print("\nOVERALL IT IS PLAUSIBLE!")
E
print("\nOVERALL IT IS IMPLAUSIBLE!")
print(‘(To be plausible, one count must exceed another by #. times)’.format(:PLAUSIBILITY_RATIO))
 
print(‘Checking plausibility of "I before E except after C":’)
V (cei, cie, not_c_ie, not_c_ei) = simple_stats()
print_result(cei, cie, not_c_ie, not_c_ei)</lang>
 
{{out}}
<pre>
Checking plausibility of "I before E except after C":
 
Checking plausibility of: I before E when not preceded by C
PLAUSIBLE. As we have counts of 465 vs 213, a ratio of 2.2 times
 
Checking plausibility of: E before I when preceded by C
IMPLAUSIBLE, probably contra-indicated. As we have counts of 13 vs 24, a ratio of 0.5 times
 
OVERALL IT IS IMPLAUSIBLE!
(To be plausible, one count must exceed another by 2 times)
</pre>
 
=={{header|8080 Assembly}}==
Line 256 ⟶ 305:
I before E when not preceded by C: plausible
E before I when preceded by C: not plausible</pre>
 
 
=={{header|ALGOL 68}}==
1,481

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.