I before E except after C: Difference between revisions
Add ed example
Langurmonkey (talk | contribs) |
(Add ed example) |
||
Line 1,840:
E before I when preceded by C: not plausible.
I before E except after C: not plausible.</pre>
=={{header|ed}}==
There are two files, one per hypothesis.
<syntaxhighlight lang="sed">
# i-before-e.ed
H
# Remove all the non-rule-related words
v/(ie|ei)/d
# Replace the occurences with one-letter markers
g/ei/s/.*/e/
g/ie/s/.*/i/
,j
# Remove 1 occurence of e (alternative) per two i (null)
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
s/eii//g
s/iie//g
# Check whether there are more i's in the output (null hypothesis true) or not
,p
Q
</syntaxhighlight>
<syntaxhighlight lang="sed">
# e-before-i-with-c.ed
H
# Remove all the non-rule-related words
v/(cie|cei)/d
# Replace the occurences with one-letter markers
g/ei/s/.*/e/
g/ie/s/.*/i/
,j
# Remove 1 occurence of i (alternative) per two e (null)
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
s/eei//
s/iee//
# Check whether there are more e's in the output (null hypothesis true) or not
,p
Q
</syntaxhighlight>
{{out}}
<pre>$ cat i-before-e.ed | ed -lEGs unixdict.txt
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiieeeeeeeeeeiiiiiii</pre>
Has more i's so the "i before e" hypothesis is plausible.
<pre>$ cat e-before-i-with-c.ed | ed -lEGs unixdict.txt
ieiiieiieiiiiieiiiiiiiiie</pre>
Has more i's, so the "e before i when preceded by c" is not plausible.
Thus, the whole rule is not plausible.
=={{header|Elixir}}==
|