I before E except after C: Difference between revisions
Content deleted Content added
→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)" |
Drkameleon (talk | contribs) added Arturo |
||
Line 740: | Line 740: | ||
<pre>[^c]ie > [^c]ei -> 466 / 217 = 2.15 :: plausible |
<pre>[^c]ie > [^c]ei -> 466 / 217 = 2.15 :: plausible |
||
cei > cie -> 13 / 24 = 0.54 :: unsupported</pre> |
cei > cie -> 13 / 24 = 0.54 :: unsupported</pre> |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">rule1: {"I before E when not preceded by C"} |
|||
rule2: {"E before I when preceded by C"} |
|||
phrase: {"I before E except after C"} |
|||
plausibility: #[ |
|||
false: "not plausible", |
|||
true: "plausible" |
|||
] |
|||
checkPlausible: function [rule, count1, count2][ |
|||
result: count1 > 2 * count2 |
|||
print ["The rule" rule "is" plausibility\[result] ":"] |
|||
print ["\tthere were" count1 "examples and" count2 "counter-examples."] |
|||
return result |
|||
] |
|||
words: read.lines relative "unixdict.txt" |
|||
[nie,cie,nei,cei]: 0 |
|||
loop words 'word [ |
|||
if contains? word "ie" -> |
|||
inc (contains? word "cie")? -> 'cie -> 'nie |
|||
if contains? word "ei" -> |
|||
inc (contains? word "cei")? -> 'cei -> 'nei |
|||
] |
|||
p1: checkPlausible rule1 nie nei |
|||
p2: checkPlausible rule2 cei cie |
|||
print ["\nSo the phrase" phrase "is" (to :string plausibility\[and? p1 p2]) ++ "."]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>The rule "I before E when not preceded by C" is plausible : |
|||
there were 465 examples and 213 counter-examples. |
|||
The rule "E before I when preceded by C" is not plausible : |
|||
there were 13 examples and 24 counter-examples. |
|||
So the phrase "I before E except after C" is not plausible.</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |