Computer Science Canada

search engine

Author:  kyo11103 [ Thu Feb 20, 2003 2:32 pm ]
Post subject:  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. Shocked

Author:  Izzy [ Thu Feb 20, 2003 10:29 pm ]
Post subject: 

Here is an idea to get you going. 8)

code:
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

Author:  Tony [ Fri Feb 21, 2003 1:18 am ]
Post subject: 

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

Author:  kyo11103 [ Mon Feb 24, 2003 11:57 pm ]
Post subject: 

Thanks Tony
the code really help alot

Author:  Tony [ Tue Feb 25, 2003 11:36 am ]
Post subject: 

its Izzy you should be thanking, he posted the code. I just gave ideas on how to modify it to suit your needs.

Wink


: