You should check Wit, it does exactly what you need.
Parsing a string intelligently to construct complex api calls [closed]
-
30-06-2022 - |
Question
I've done a few hours of research but I've yet to find the golden answer. This is one of those research topics I find difficult to explain to Google search.
Anyway, my goal is to take a string like below,
Step 1: User searches for, "3 bedroom apartment $2600 San Francisco".
Step 2: ?????? Magic happens in this layer ???????
Step 3: Intelligent api search string is constructed:
http://api.service.com/?city=San%20Francisco&heading="3 bedroom apartment"|"three bedroom apartment"|"3 bedroom apt"|"three bedroom apt"&min_price=2200&max_price=2800
The magic is Step 2 should be able to handle:
- mis-spellnigs
- Correctly predicts city
- Understands what a number means (if it is currency a.k.a "$3" or "3 dollars" or a value for something).
- Throws out common articles like "and", "the", etc.
Preferably, the solution uses PHP or Javascript asynchronous call to a third-party service I could use to perform the database algorithms and magic (Google??). I'm open to building something with some open-source code that uses my own database too if needed.
Thanks guys for the insight!
Solution