I before E except after C: Difference between revisions
Content added Content deleted
Line 2,072: | Line 2,072: | ||
Clause 2 not plausible (13 examples; 24 counterexamples) |
Clause 2 not plausible (13 examples; 24 counterexamples) |
||
Overall, the rule is not plausible |
Overall, the rule is not plausible |
||
</pre> |
|||
=={{header|VBScript}}== |
|||
The sample text was downloaded and saved in the same folder as the script. |
|||
<lang vb> |
|||
Set objFSO = CreateObject("Scripting.FileSystemObject") |
|||
Set srcFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ |
|||
"\unixdict.txt",1,False,0) |
|||
cei = 0 : cie = 0 : ei = 0 : ie = 0 |
|||
Do Until srcFile.AtEndOfStream |
|||
word = srcFile.ReadLine |
|||
If InStr(word,"cei") Then |
|||
cei = cei + 1 |
|||
ElseIf InStr(word,"cie") Then |
|||
cie = cie + 1 |
|||
ElseIf InStr(word,"ei") Then |
|||
ei = ei + 1 |
|||
ElseIf InStr(word,"ie") Then |
|||
ie = ie + 1 |
|||
End If |
|||
Loop |
|||
FirstClause = False |
|||
SecondClause = False |
|||
Overall = False |
|||
'testing the first clause |
|||
If ie > ei*2 Then |
|||
WScript.StdOut.WriteLine "I before E when not preceded by C is plausible." |
|||
FirstClause = True |
|||
Else |
|||
WScript.StdOut.WriteLine "I before E when not preceded by C is NOT plausible." |
|||
End If |
|||
'testing the second clause |
|||
If cei > cie*2 Then |
|||
WScript.StdOut.WriteLine "E before I when not preceded by C is plausible." |
|||
SecondClause = True |
|||
Else |
|||
WScript.StdOut.WriteLine "E before I when not preceded by C is NOT plausible." |
|||
End If |
|||
'overall clause |
|||
If FirstClause And SecondClause Then |
|||
WScript.StdOut.WriteLine "Overall it is plausible." |
|||
Else |
|||
WScript.StdOut.WriteLine "Overall it is NOT plausible." |
|||
End If |
|||
srcFile.Close |
|||
Set objFSO = Nothing |
|||
</lang> |
|||
{{Out}} |
|||
<pre> |
|||
I before E when not preceded by C is plausible. |
|||
E before I when not preceded by C is NOT plausible. |
|||
Overall it is NOT plausible. |
|||
</pre> |
</pre> |
||