Entity base on context

I want to create an entity in context as follows: If it is in the situation of asking about branch code, the system must understand it as branch code, but in other situations it is not For example: When I say [500] in the situation is asking the user to provide branch code. In contrast, in other situations it may be the transaction amount. I have to set up the entity accordingly? Looking forward to getting help and good ideas!

I think you can provide a regex pattern in your nlu data for 3 digit branch code! assuming the branch code always remains 3 digit! This works the same way as if you want to enter pincode for an area!

hey @kenoiloan, i would like to suggest your training would be like this:

suppose for extracting branch code you can add utterance like :

  • My branch code is [500] (branch_code)

  • branch code is [300] (branch_code)

for extracting amount you can add utterance like

  • [500] (amount)

  • transaction amount is [300] (amount)

so if you have above traning data the model wont get confused between amount & zip code & if you want to extract zip code in a particular format u can use regex in the above utterance for zip code

Hope this helps😃

@JiteshGaikwad I think the bot will get confused since it’s a number in both the cases (even though there is different utterance, it won’t be robust). Also, the amount and code can be any number of digits right?

hey @srikar_1996 thanks for the suggestion but if you train the data with the utterances properly it wont get confused & as far as detecting the amount & code the number of digits we can use regex or duckling’s AmountOfMoney dimensions, anyway i just suggested :sweat_smile:

Thanks @JiteshGaikwad I am reading rasa doc.API Reference - > Training Data Format I think it can help me I will report the results as soon as possible

Thanks you very much

Try what we suggested here:

You can run separate NLU models on a standalone Rasa NLU server and dedicate that server to whatever entity you need to get in response to the question you asked. This write up is more theoretical, if there’s more interest, we’ll post the code we used to get this done with a detailed write-up.