home *** CD-ROM | disk | FTP | other *** search
- on phraseLookUp thePhrase
- set result to -1
- repeat while 1
- set result to TryNormal(thePhrase)
- if result > 0 then
- exit repeat
- end if
- set result to tryPlural(thePhrase)
- if result > 0 then
- exit repeat
- end if
- set result to TryPast(thePhrase)
- if result > 0 then
- exit repeat
- end if
- set result to TryItalian(thePhrase)
- if result > 0 then
- exit repeat
- end if
- set result to TryLatin(thePhrase)
- if result > 0 then
- exit repeat
- end if
- delete word 1 of thePhrase
- if the number of words in thePhrase = 0 then
- exit repeat
- end if
- end repeat
- return result
- end
-
- on TryNormal w
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- return -1
- end
-
- on tryPlural w
- if the last char in w = "s" then
- delete char -30000 of w
- put w
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- if the last char in w = "e" then
- put w
- delete char -30000 of w
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- if the last char in w = "i" then
- delete char -30000 of w
- set w to w & "y"
- put w
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- end if
- end if
- end if
- return -1
- end
-
- on TryPast w
- if the last char in w = "d" then
- delete char -30000 of w
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- if the last char in w = "e" then
- delete char -30000 of w
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- end if
- end if
- return -1
- end
-
- on TryItalian w
- if the last char in w = "i" then
- delete char -30000 of w
- set w to w & "o"
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- end if
- return -1
- end
-
- on TryLatin w
- if the last char in w = "a" then
- delete char -30000 of w
- set w to w & "um"
- set try to BinarySearch(w)
- if try > 0 then
- return try
- exit
- end if
- end if
- return -1
- end
-