50 lines
1.4 KiB
Text
50 lines
1.4 KiB
Text
Function getfile(file As String) As String
|
|
Dim As Integer F = Freefile
|
|
Dim As String text,intext
|
|
Open file For Input As #F
|
|
Line Input #F,text
|
|
While Not Eof(F)
|
|
Line Input #F,intext
|
|
text=text+Chr(10)+intext
|
|
Wend
|
|
close #F
|
|
Return text
|
|
End Function
|
|
|
|
Function TALLY(instring As String,PartString As String) As Integer
|
|
Dim count As Integer
|
|
var lens2=Len(PartString)
|
|
Dim As String s=instring
|
|
Dim As Integer position=Instr(s,PartString)
|
|
If position=0 Then Return 0
|
|
While position>0
|
|
count=count+1
|
|
position=Instr(position+Lens2,s,PartString)
|
|
Wend
|
|
Function=count
|
|
End Function
|
|
|
|
Dim As String myfile="unixdict.txt"
|
|
|
|
Dim As String wordlist= getfile(myfile)
|
|
wordlist=lcase(wordlist)
|
|
|
|
print
|
|
print "The number of words in unixdict.txt ",TALLY(wordlist,chr(10))+1
|
|
print
|
|
dim as integer cei=TALLY(wordlist,"cei")
|
|
print "Instances of cei",cei
|
|
dim as integer cie=TALLY(wordlist,"cie")
|
|
print "Instances of cie",cie
|
|
print
|
|
dim as integer ei=TALLY(wordlist,"ei")
|
|
print "Instances of *ei, where * is not c",ei-cei
|
|
dim as integer ie=TALLY(wordlist,"ie")
|
|
print "Instances of *ie, where * is not c",ie-cie
|
|
print
|
|
print "Conclusion:"
|
|
print "ie is plausible when not preceeded by c, the ratio is ";(ie-cie)/(ei-cei)
|
|
print "ei is not plausible when preceeded by c, the ratio is ";cei/cie
|
|
print "So, the idea is not plausible."
|
|
|
|
Sleep
|