I before E except after C: Difference between revisions

Content added Content deleted
(Added Delphi example)
Line 3,031: Line 3,031:
e before i in general (pro: 230, anti: 490) is not plausible
e before i in general (pro: 230, anti: 490) is not plausible
</pre>
</pre>

=={{header|Picat}}==
<lang Picat>main =>
Words = read_file_lines("unixdict.txt"),
IEWords = [Word : Word in Words, find(Word,"ie",_,_)],
EIWords = [Word : Word in Words, find(Word,"ei",_,_)],

% cie vs not cie
[CIE_len, CIE_not_len] = partition_len(IEWords,"cie"),
println([cie=CIE_len,cie_not=CIE_not_len]),

% cei vs not cei
[CEI_len, CEI_not_len] = partition_len(EIWords,"cei"),
println([cei=CEI_len,cei_not=CEI_not_len]),

nl,
printf("I before E when not preceeded by C (%d vs %d): %w\n",
CIE_not_len,CEI_not_len,plausible(CIE_not_len,CEI_not_len)),
printf("E before I when preceeded by C (%d cs %d): %w\n",
CEI_len,CIE_len,plausible(CEI_len,CIE_len)).

plausible(Len1,Len2) = cond(Len1 / Len2 > 2,"plausible","not plausible").

partition_len(Words,Sub) = [True.len, False.len] =>
True = [],
False = [],
foreach(Word in Words)
if find(Word,Sub,_,_) then
True := [Word|True]
else
False := [Word|False]
end
end.</lang>

{{out}}
<pre>[cie = 24,cie_not = 465]
[cei = 13,cei_not = 213]

I before E when not preceeded by C (465 vs 213): plausible
E before I when preceeded by C (13 cs 24): not plausible</pre>


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==