RosettaCodeData/Task/I-before-E-except-after-C/PureBasic/i-before-e-except-after-c.b...

24 lines
1.0 KiB
Plaintext

If ReadFile(1,GetPathPart(ProgramFilename())+"wordlist(en).txt")
While Not Eof(1)
wl$+ReadString(1)+";"
Wend
CloseFile(1)
EndIf
OpenConsole()
PrintN("Number of words in [wordlist(en).txt]: "+CountString(wl$,";"))
cei.i=CountString(wl$,"cei") : PrintN("Instances of [cei] : "+Str(cei))
cie.i=CountString(wl$,"cie") : PrintN("Instances of [cie] : "+Str(cie))
Print("Rule: 'e' before 'i' when preceded by 'c' is = ")
If cei>cie : PrintN("plausible") : Else : PrintN("not plausible") : EndIf
wl$=RemoveString(wl$,"cei") : wl$=RemoveString(wl$,"cie")
PrintN("")
ei.i=CountString(wl$,"ei") : PrintN("Instances of [*ei] '*'<>'c' : "+Str(ei))
ie.i=CountString(wl$,"ie") : PrintN("Instances of [*ie] '*'<>'c' : "+Str(ie))
Print("Rule: 'i' before 'e' when not preceded by 'c' is = ")
If ie>ei : PrintN("plausible") : Else : PrintN("not plausible") : EndIf
PrintN("")
Print("Overall the rule is : ")
If cei>cie And ie>ei : PrintN("PLAUSIBLE") : Else : PrintN("NOT PLAUSIBLE") : EndIf
Input()