Distinguishing Between Numbers

Hello there, I would just like to know how, specifically in rasa nlu I can successfully have rasa nlu distinguish between a 16 digit credit card number and a 3 digit cvv.

I currently have 1 intent, “inform” and two different entities. I have 50 examples of each in my training examples of a 16 digit number string classifying credit card and vice versa, however, it is not grabbing the appropriate entities.

Hi Adrian. That soulds like an NER problem. https://en.wikipedia.org/wiki/Named-entity_recognition Have you looked into using/modifying any of the supported ner systems? https://nlu.rasa.com/entities.html?highlight=ner I haven’t done so myself yet, but I expect it ner_duckling for a lot of things.

I would suggest just using ner_duckling to extract the numbers, and then checking in a custom action whether they’re of the appropriate format

How exactly would this look like? Do you have any links or code snippets I can look at. I am unfamiliar with ner_duckling

You can try it out here: https://duckling.wit.ai/

The install instructions are on their github page. It takes a while to compile. https://github.com/facebook/duckling/ To run duckling you start a webservice

stack exec duckling-example-exe

Afterwards you can add duckling to your pipeline. There are some clues here: http://forum.rasa.com/t/how-to-use-duckling-in-pipeline/91/6

You can also run our docker container rasa/duckling Docker Hub if you don’t want to have to install everything from scratch :smiley:

1 Like

Hi Adrian,

How about using a regular expression to extract 16 digit credit card number and a 3 digit cvv.

Check doc for more detail: https://rasa.com/docs/nlu/entities/#regular-expressions-regex