Code: Select all
Dim np$(30) as string, pncttn$(30) as string
Dim wd$(10000) As String, iwd$(30000) As String, dwd$(5000) As String, idwd$(30000) As String
Dim insen$ as STRING, cw AS INTEGER, f as integer
declare SUB innomeOne(byref insen$ as string , byref cw as integer , np$() as string , pncttn$() as string)
Input "Tell me something: ", insen$
innomeOne(insen$ , cw , np$() , pncttn$())
print np$(1)
print np$(2)
print np$(3)
print np$(4)
print np$(5)
print cw
f=1
sleep
SUB innomeOne(byref insen$ as string , byref cw as integer , np$() as string , pncttn$() as string)
'' this nome processes the input sentence for use by the rest of the program
'' it removes punctuation and puts everything in lower case
'' it counts the number of words in the input sentence, remembering it in cw
'' it also stores the individual words in np$() and the punctuation of each word in pncttn$()
dim islen as INTEGER, thisword$ as string, thswdln as integer, x as integer
insen$=LCase(insen$)
islen=len(insen$)
cw=1
thisword$=""
For x=1 To islen
If Mid(insen$, x, 1) <> " " then
thisword$=thisword$+Mid(insen$, x, 1)
EndIf
If Mid(insen$, x, 1) = " " then
np$(cw)=thisword$
If Right(np$(cw), 1) = "." Or Right(np$(cw), 1) = "?" Or Right(np$(cw), 1) = "!" Or Right(np$(cw), 1) = "," Or Right(np$(cw), 1) = ";" Or Right(np$(cw), 1) = ":" then
thswdln=Len(np$(cw))
pncttn$(cw)=Right(np$(cw), 1)
np$(cw)=Left(np$(cw), thswdln-1)
EndIf
thisword$=""
cw=cw+1
EndIf
Next
np$(cw)=thisword$
If Right(np$(cw), 1) = "." Or Right(np$(cw), 1) = "?" Or Right(np$(cw), 1) = "!" Or Right(np$(cw), 1) = "," Or Right(np$(cw), 1) = ";" Or Right(np$(cw), 1) = ":" then
thswdln=Len(np$(cw))
pncttn$(cw)=Right(np$(cw), 1)
np$(cw)=Left(np$(cw), thswdln-1)
EndIf
thisword$=""
End Sub
Code: Select all
Dim wd$(10000) As String, iwd$(30000) As String, dwd$(5000) As String, idwd$(30000) As String, awd$(30000) As String