Numbers processing

Add skill common-numbers in the .dashaapp file

{ "formatVersion": "2", "dialogue": { "file": "main.dsl" }, "nlu": { "language": "en-US", "skills": [ "common-numbers" ] }, "nlg": { "type": "phrases", "file": "phrasemap.json", "signatureFile": "phrasemap.json" }, "name": "numbers-app" }

Now you can catch two types of numbers

  1. numberword - processed number, like One hundred two millions three thousands one, you will receive 102003001. numberword supports negative values
  2. dictated - processed sequence of numbers, like seven ones and fourty three, you will receive 111111143. Negative values are not supported

Note: numberword and dictated are independent and will be extracted at the same time

DSL Example:

context { input endpoint: string; output numberword: number? = null; output dictated: string? = null; } start node root { do //actions executed in this node { #connectSafe($endpoint); // connecting to the phone number which is specified in index.js that it can also be in-terminal text chat goto ask; } transitions // specifies to which nodes the conversation goes from here { ask: goto ask; } } node ask { do { if ($numberword is null) { #sayText("Give me a number"); wait *; } #sayText("The number is " + $numberword.toString()); if ($dictated is not null) { #sayText("Dictated number is " + $dictated); } wait *; } transitions { ask: goto ask on true; } } preprocessor digression get_number { conditions { on #messageHasData("numberword"); } do { set $numberword = #messageGetData("numberword")[0]?.value?.parseNumber(); return; } } preprocessor digression get_dictated { conditions { on #messageHasData("dictated"); } do { set $dictated = #messageGetData("dictated")[0]?.value; return; } }
Found a mistake? Let us know.

    Enroll in beta

    Request invite to our private Beta program for developers to join the waitlist. No spam, we promise.