I want to make an personal assistant using artificial intelligence and machine learging techniques. I am using Python 3.7 and I have an question.
When software starts, first it will ask user’s name. I want it to get user’s name.
in = input('Hey, what is your name?')
#some classifier things
#...
print = input('Nice to meet you ' + in + '!')
But I want to know name correctly if user enters an sentence.
Here is an example:
Hey, what is your name?
John
Nice to meet you John!
But I want to get name even if person enters like this:
Hey, what is your name?
It's John.
Nice to meet you John!
But I couldn’t understand how can I just get the user’s name. I think I should classify the words in sentence but I don’t know. Can you help?
2
Answers
You need to get proper nouns. The below code does it:
You can use Spacy name entity recognition toolkit. It recognizes various entities including Person, Country, Organization and …
Following code is a working example of how you can use it:
Output:
Note: You may also need to download the Spacy model before running the above script: