I basically will create a ton of websites and attribute a name to it. I want it so if the player type on a textbox “houses for sale” it will return the results, but also it will return results if the player makes a typo “hiuses four sale” or use different words, such “homes for sale”
Any help will be highly appreciated!
please don’t tell me I’ll have to use a bunch of if’s
I’m afriad it will be extremely difficult for you to implement.
You will have to add some sort of auto-correct to the search, and run over multiple different possiblities. Autocorrects can be painful in itself to implmenet.
On top of autocorrect, you need to actually search for relevant items, which is also a monumental task, unless you are going to have the user type very specific phrases e.g. ‘houses for sale’, but not ‘house sale’, in which case you can just loop through all possibile searches and find the best one i guess.
I’m pretty sure the best bet you could probably do is using a pairs loop through some type of database/table and using string.find to find the keywords. not sure how you would implement misspelling though, or maybe my stupid brain can’t find a solution…
this video explains the methods used to do search queries, fast (the objective in the video is to make it fast, so It might be overwhelming). However I don’t know if it includes autocorrecting the query. I found an article about recreating google’s spellchecking:
you can use an ai to check for spelling mistakes and sorting it all maybe thats ur best bet
or you could make an algorithm yourself which will be probably pretty difficult