James_Tarling | 2022-02-28 22:27:58 UTC | #1
I have a bot with a regular expression slot type with the following pattern \d+(?:\.\d+)?
This should capture strings with both integers and floats 123 or 123.45
If I save the bot and use the Test NLU functionality in Architect, I can see that 123.45 can be successfully identified
If I try and include the Slot value in a communication, the . character is omitted. If I check for a . character using Contains(Slot.MySlot, "."), this equals false
I would like to be able to include the whole slot value, including the . in a communication and as a parameter to a data action
Anton_Vroon | 2022-03-01 01:17:43 UTC | #2
I get the same result with that regular expression for the slot type
If instead use the built in Currency Slot Type for the slot, and then convert to Decimal, it works fine
Hope it helps point you in the right direction or works as a workaround, but I suspect its to do with the RegEx, or how it stores the value as string.
Anton_Vroon | 2022-03-01 01:26:55 UTC | #3
The built in Number Slot Type also works fine for this, no need to convert to decimal
James_Tarling | 2022-03-01 17:40:37 UTC | #4
Thanks for the workaround
A decimal value always seems to be displayed with a .0 for an integer. Ideally I would be able to display whatever the user typed e.g. 123 or 123.45. I can get around this with some nasty string manipulation but would prefer something simpler.
Cheers
Javed_Bhayla | 2022-03-03 09:03:26 UTC | #5
Hi James,
If you add NO_HINT to your list of regexes it should fix your issue and your input of "123.45" will be recognised instead of the "12345" you're getting currently.
Javed.
James_Tarling | 2022-03-02 16:30:19 UTC | #6
Thanks Javed
Could you explain what NO_HINT does please - is there a reference for it?
Javed_Bhayla | 2022-03-02 18:02:43 UTC | #7
NO_HINT is a new feature which is used to help with recognition issues like above for regex slot types. Currently there is no documentation but it is being worked on and will be coming out soon.
system | 2022-04-01 18:03:26 UTC | #8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 13736