Reputation: 1252
I'm creating a simple chatbot. I want to obtain the information from the user response. An example scenario:
Bot : Hi, what is your name?
User: My name is Edwin.
I wish to extract the name Edwin from the sentence. However, the user can response in different ways such as
User: Edwin is my name.
User: I am Edwin.
User: Edwin.
I'm tried to rely on the dependency relations between words but the result does not do well.
Any idea on what technique I could use to tackle this problem?
Upvotes: 0
Views: 681
Reputation: 6039
I'd suggest using NER:
You can play with it yourself: http://nlp.cogcomp.org/
Upvotes: 1
Reputation: 18379
Detecting names can be complicated if you consider things like "My name is not important", "My name is very long", etc.
Here is public domain script in Self that attempts to parse a name, you may be able to adapt it to python, it also does some crazy stuff like lookup the words on Wiktionary to see if they are classified as names,
https://www.botlibre.com/script?id=525804
Upvotes: 0
Reputation: 419
There are many alternatives, over only 2 'models':
Based on NLP training; uses HTTP for integration/delivery:
based on pattern matching; uses an interpreter (needs an native implementation or a bridge from other implementation)
This is not an extensive listing of current options.
Upvotes: 0
Reputation: 16710
First off, I think a complete name detection is really heavy to set up. If you want your bot to be able to detect a name in like 99% of the cases, you've got some work. And I suppose the name detection is only the very beginning of your plans...
This said, here are the first ideas that came to my mind:
However, I am no AI specialist, and I'm looking forward to seeing other proposals.
Upvotes: 1