Search code examples
nlpnltk

Extracting a password from a sentence using NLP


I am developing a bot, which will be used for account management. I'm currently trying this with the yake but am open to other suggestions.

I want to parse sentences similar to the one below

Add a mail account XYZ  with username Xname with password XYZ@123#

I need to extract mail, Xname and XYZ@123# but am unable to do this. The library doesn't parse the password since it's meaningless.

How would I go about doing this?


Solution

  • Are sentences always like "...mail account <account_name> ... username <username> ... password <password>"?
    In this case you can use regexes. I can write the corresponding code if needed.

    Otherwise, you should investigate Spacy library and is Named Entity Recognition. Start by this tutorial about training your own NER with SpaCy.