
-----------------------------------
kyo11103
Thu Feb 20, 2003 2:32 pm

search engine
-----------------------------------
How do I make a search engine in turing that would search for items in an array. Also the search engine must allow for inexact matches or misspell words.  :shock:

-----------------------------------
Izzy
Thu Feb 20, 2003 10:29 pm


-----------------------------------
Here is an idea to get you going. 8)

var a: array 1..10 of string
var word: string

a(1) := "hey"
a(2) := "hi"
a(3) := "swat"
a(4) := "turing"
a(5) := "school"
a(6) := "dog"
a(7) := "computer"
a(8) := "horse"
a(9) := "truck"
a(10) := "dragon"

put "Please enter the word you would like to search for"
get word

for i: 1..10
    if a(i) = word then
        put "This word is found in a(",i,")"
    end if
end for

This is an idea of how you could set it up. For providing leverage with the search try things like converting all the letters to the same case when checking if they are the same, etc. Anyway just play around with it a bit. Sorry gotta go to school

- Izzy

-----------------------------------
Tony
Fri Feb 21, 2003 1:18 am


-----------------------------------
about mispelled words.. you can check for each letter in the string and output the results based on how many letters matched... Though if you add extra letter in the middle of the word, half the letters not gonna match

-----------------------------------
kyo11103
Mon Feb 24, 2003 11:57 pm


-----------------------------------
Thanks Tony
the code really help alot

-----------------------------------
Tony
Tue Feb 25, 2003 11:36 am


-----------------------------------
its Izzy you should be thanking, he posted the code. I just gave ideas on how to modify it to suit your needs.

 :wink:
