# How to extract username & password entities from text?

**URL:** <https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803>\
**Category:** Rasa Open Source\
**Created:** [July 11, 2019, 10:36am UTC](https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803 "2019-07-11T10:36:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alihejazi](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@alihejazi](https://forum.rasa.com/u/alihejazi)\
**Post date:** [July 11, 2019, 10:36am UTC](https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803/1 "2019-07-11T10:36:32Z")

</div>

Hi everyone!

I’m building a chatbot to take the username and password from a user and use them to login to a platform.

How to I train Rasa NLU to pick up a username? Theoretically speaking, there are infinitely many usernames and passwords. So I don’t know how to train NLU as there is no specified format.

Chatbot example:

Chatbot: May I please have your username? User could respond with “username”, or “My username is …”, or “It is …”, or “it’s …” etc.

Chatbot: Thanks, may I please have your password too? User could respond with “password”, or “My password is …”, or “It is …”, or “it’s …” etc.

Can someone please help me with how to train NLU to pick up these credentials?

Also please tell me how to save them to slots, so I can call a custom action to log the user in.

If I’m doing anything wrong, please let me know!

Thanks!

---

<div class="post-metadata">

**Author:** ![jabberlope](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/jabberlope/32/3201_2.png) [@jabberlope](https://forum.rasa.com/u/jabberlope)\
**Post date:** [July 11, 2019, 2:35pm UTC](https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803/2 "2019-07-11T14:35:05Z")

</div>

Hi @alihejazi, check out this reply to my similar request. You should use a form action and then extract those unique fields from the user’s last response.

> [@How best to fill a slot that can have any value](http://forum.rasa.com/t/how-best-to-fill-a-slot-that-can-have-any-value/11494/4):
>
> You can check out this post on how to use forms: [Building contextual assistants with Rasa Forms](https://blog.rasa.com/building-contextual-assistants-with-rasa-formaction/) Rather than using a custom action for just filling a product slot, you could use the validate\_[slot] method in forms to validate whenever the slot is filled. For the slot value to be set to whatever the user enters, you can use sth like this in the slot\_mapping function. def slot\_mappings(self) -\> Dict[Text, Union[Dict, List[Dict]]]: return { "loan\_amount": self.from\_text(intent=None), …

---

<div class="post-metadata">

**Author:** ![alihejazi](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@alihejazi](https://forum.rasa.com/u/alihejazi)\
**Post date:** [July 15, 2019, 2:54pm UTC](https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803/3 "2019-07-15T14:54:02Z")

</div>

@jabberlope Thank you very much for the help. Took quite a while for me to understand because there’s lots of reading, but it works now.

---

<div class="post-metadata">

**Author:** ![jabberlope](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/jabberlope/32/3201_2.png) [@jabberlope](https://forum.rasa.com/u/jabberlope)\
**Post date:** [July 15, 2019, 9:14pm UTC](https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803/4 "2019-07-15T21:14:45Z")

</div>

Glad I could help @alihejazi!

---

<div class="post-metadata">

**Author:** ![karthik1](https://avatars.discourse-cdn.com/v4/letter/k/bc8723/32.png) [@karthik1](https://forum.rasa.com/u/karthik1)\
**Post date:** [November 27, 2019, 10:58pm UTC](https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803/5 "2019-11-27T22:58:27Z")

</div>

Hi all,

I want get the username from the chat conversations

example:- bot:- Hi user:- Hi Bot: May i know your name? User: I am Karthik Bot : Thanks for providing details Karthik

Like the above example i have call the user with there name can anybody please help

---

<div class="post-metadata">

**Author:** ![shadhin.int](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/shadhin.int/32/6091_2.png) [@shadhin.int](https://forum.rasa.com/u/shadhin.int)\
**Post date:** [January 5, 2020, 7:21pm UTC](https://forum.rasa.com/t/how-to-extract-username-password-entities-from-text/12803/6 "2020-01-05T19:21:52Z")

</div>

can u describe or provide the source code please ?
