Python V3 query for getting results of mis-spelled words search

Hi Team,

I want to fetch results for mis-spelled words i.e. when a user types ‘sprate’ instead of ‘sprite’ search, he has to see the results for ‘sprite’. Another example would be when user types ‘man’ instead of ‘men’, he has to see results for ‘men’.

I tried few examples in python using ‘with_near_text’ and the below query but couldn’t get the results that I’m expecting. Could you please let me know what exactly is the query for my usecase?

Define the near_text query

near_text = {
“concepts”: [“man”], # Correct the spelling here
}

Perform the query

result = (
client.query
.get(“TGIDICTIONARY3”, [“answerlabels”,“questionlabel”] )
.with_near_text(near_text)
.do()
)

Print the results

print(result)

Thanks for your Help in Advance !!!

Hi @Praveenkasani,

Welcome to our community, and it’s lovely to have you here!

Based on what you described, you can leverage the Weaviate text-spellcheck module to handle cases where a user types a misspelled word.

You can explore more here: Weaviate Spellcheck Module

Also, you can experiment with near_text certainty to fine-tune the matching accuracy.