I want to interpret specific keywords from a free text such as "I want to order boiled eggs and spinach soup from nearest restaurants' and use them to search content from my database. For eg i want to extract following specific keyword(s) and want an output similar to following like a tuple of (Keyword type , Keyword value). eg ('Food Item','Boiled Eggs') , ('Food Item','Spinach Soup') , ('Location','Nearest Restaurants') etc.
Need to use these values and types to further refine and to query my tables in database.
I was trying hard to find answer using various techniques using python and NLTK but need help to point me to right direction. Am i using the right techniques / frameworks? Need help here
Thanks, Sammy
It's not that difficult, but not that super precise either.
Use NLTK's PoS Tagging , then extract nouns
and compound nouns
, and use them in your DB queries.
A natural sentence is practically has two parts, an action, ie the verb, and a noun, ie the object.
Hence, "I want to order boiled eggs and spinach soup from nearest restaurants" tells us that:
order
boiled eggs
and spinach soup
nearest restaurants
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.