'Spell checker example - wxv722-1
'Uses Dictionary.GetDefinition(word) - Need internet access
'Harry Hardjono
'June 2012
'
Init:
Str="abcdefghijklmnopqrstuvwxyz'ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Word=""
Loop:
TextWindow.BackgroundColor="black"
TextWindow.ForegroundColor="white"
TextWindow.WriteLine(" ")
TextWindow.WriteLine("Enter your sentence: ")
inputtext=text.Append(TextWindow.Read()," ") 'bug fix. ^_^;
If (inputtext=" ") Then
Goto End
EndIf
For i=1 To Text.GetLength(inputtext)
curchar=Text.GetSubText(inputtext,i,1)
If (Text.GetIndexOf(Str,curchar)=0) Then
'Not word
If (Word<>"") Then
WordDef=Dictionary.GetDefinition(Word)
If (WordDef="") Then
TextWindow.BackgroundColor="white"
TextWindow.ForegroundColor="black"
TextWindow.Write(Word)
TextWindow.BackgroundColor="black"
TextWindow.ForegroundColor="white"
Else
TextWindow.Write(Word)
EndIf
Word=""
EndIf
TextWindow.Write(curchar)
Else 'Word
Word=Text.Append(Word,curchar)
EndIf
endfor
Goto Loop
End:
Program.End()
No comments:
Post a Comment