Search code examples
nlpnltkstanford-nlpspacyrasa-nlu

NLP Entity Recognition Inquiry


I am working on an NLP Chatbot project. The Chatbot will need to process requests like the following:

"I want to go to Penn Station from Back Bay Station" and "I want to go from Back Bay Station to Penn Station"

In each case, I want to extract the source train station as "Back Bay Station" and the destination as "Penn Station." However, because of the sentence re-ordering, I am not sure how to do this.

Any advice, including examples, would be much appreciated.


Solution

  • Two ways.

    1. Heuristics: Look for words like 'to' and 'from' and similar before the entities. You might have to spend some time creating a library of these prepositions or subordinating conjunctions but that will do the job.
    2. Use more sophisticated deep parsers that can do this job for you. You might have to still fall back to heuristics here as well, but you can get much more information this way. I am suggesting this option because I don't know how wide your problem statement is. If it is just about 'to' and 'from' then stick to option 1