facebook / duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Other
4.05k stars 720 forks source link

A particular case where duckling fails to extract a valid credit card number #680

Open nvinayvarma189 opened 2 years ago

nvinayvarma189 commented 2 years ago

when I try

curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_US&text="4111111111111111"&dims="["credit-card-number"]"'

I seem to be getting the credit card number captured. And when I continued to test with more sample numbers, I've observed that duckling does not recognize the numbers which are invalid.

But I came across a valid credit card number which duckling was not able to recognize

curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_US&text="60115564485789458"&dims="["credit-card-number"]"'

60115564485789458 is a 17 digit valid credit card number. I'm not sure what makes this number different from other valid numbers and also if there are more numbers like this.

So I have two questions

  1. Does my assumption of "duckling not extracting invalid credit card numbers" always hold true?
  2. Can we update the rules to make duckling work for numbers like 60115564485789458?

thanks for your time :pray:

birla commented 2 years ago

@nvinayvarma189 the sample number is not matching any rule defined, the closest match rule is able to extract 16 digits from it after which the Luhn checksum fails hence duckling does not detect this as a valid credit card number. See this file for details.