recognizing “4 days back” using @sys.date












0














I have an intent which takes date as input. I have used @sys.date to recognize date which is able to recognize many date formats including today, 2 nov, 2 days ago.

However, surprisingly it is not able to map phrase like 2 days back to a specific date.

Is there any way to make it work?



days ago



days back










share|improve this question





























    0














    I have an intent which takes date as input. I have used @sys.date to recognize date which is able to recognize many date formats including today, 2 nov, 2 days ago.

    However, surprisingly it is not able to map phrase like 2 days back to a specific date.

    Is there any way to make it work?



    days ago



    days back










    share|improve this question



























      0












      0








      0







      I have an intent which takes date as input. I have used @sys.date to recognize date which is able to recognize many date formats including today, 2 nov, 2 days ago.

      However, surprisingly it is not able to map phrase like 2 days back to a specific date.

      Is there any way to make it work?



      days ago



      days back










      share|improve this question















      I have an intent which takes date as input. I have used @sys.date to recognize date which is able to recognize many date formats including today, 2 nov, 2 days ago.

      However, surprisingly it is not able to map phrase like 2 days back to a specific date.

      Is there any way to make it work?



      days ago



      days back







      dialogflow chatbot api.ai






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 14 at 11:18

























      asked Nov 20 at 13:44









      sid8491

      2,58121232




      2,58121232
























          1 Answer
          1






          active

          oldest

          votes


















          3














          You cannot add to system entities (entities that start with @sys) but you can create your own composite date entity using a custom date unit entity (that includes "days back") and the system number entity:




          1. Create a new date-unit entity with the value days and the synonym days back:

            and save the entity

          2. Create another entity called Date, uncheck the box for Define synonyms and enter @sys.number @date-unit for the value of the entity:
            enter image description here
            and save the entity

          3. Next add the X days back training example to an intent, which should be auto-annotated (if not highlight the training phrase and annotate it manually):
            enter image description here
            and save the intent. Try it out by querying your agent with a X days back query.


          The JSON you receive from this payload will vary based on if the @sys.date entity was recognized or if the @Date entity you just created was recognized. The JSON payload for the 17 days back query that your webhook will receive looks like this:



          {
          "responseId": "1f67167c-8840-42ed-b3ed-420e2c2b1c43",
          "queryResult": {
          "queryText": "17 days back",
          "parameters": {
          "Date": "17 days"
          },
          "allRequiredParamsPresent": true,
          "fulfillmentMessages": [
          {
          "text": {
          "text": [
          ""
          ]
          }
          }
          ],
          "intent": {
          "name": "projects/anotheragent-c5ea8/agent/intents/6743e47a-8cb5-458d-b573-626d1a392a46",
          "displayName": "Date"
          },
          "intentDetectionConfidence": 1,
          "languageCode": "en"
          }
          }


          so you'll need to add some logic in your webhook to parse this date type in addition to the @sys.date type.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394393%2frecognizing-4-days-back-using-sys-date%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            You cannot add to system entities (entities that start with @sys) but you can create your own composite date entity using a custom date unit entity (that includes "days back") and the system number entity:




            1. Create a new date-unit entity with the value days and the synonym days back:

              and save the entity

            2. Create another entity called Date, uncheck the box for Define synonyms and enter @sys.number @date-unit for the value of the entity:
              enter image description here
              and save the entity

            3. Next add the X days back training example to an intent, which should be auto-annotated (if not highlight the training phrase and annotate it manually):
              enter image description here
              and save the intent. Try it out by querying your agent with a X days back query.


            The JSON you receive from this payload will vary based on if the @sys.date entity was recognized or if the @Date entity you just created was recognized. The JSON payload for the 17 days back query that your webhook will receive looks like this:



            {
            "responseId": "1f67167c-8840-42ed-b3ed-420e2c2b1c43",
            "queryResult": {
            "queryText": "17 days back",
            "parameters": {
            "Date": "17 days"
            },
            "allRequiredParamsPresent": true,
            "fulfillmentMessages": [
            {
            "text": {
            "text": [
            ""
            ]
            }
            }
            ],
            "intent": {
            "name": "projects/anotheragent-c5ea8/agent/intents/6743e47a-8cb5-458d-b573-626d1a392a46",
            "displayName": "Date"
            },
            "intentDetectionConfidence": 1,
            "languageCode": "en"
            }
            }


            so you'll need to add some logic in your webhook to parse this date type in addition to the @sys.date type.






            share|improve this answer


























              3














              You cannot add to system entities (entities that start with @sys) but you can create your own composite date entity using a custom date unit entity (that includes "days back") and the system number entity:




              1. Create a new date-unit entity with the value days and the synonym days back:

                and save the entity

              2. Create another entity called Date, uncheck the box for Define synonyms and enter @sys.number @date-unit for the value of the entity:
                enter image description here
                and save the entity

              3. Next add the X days back training example to an intent, which should be auto-annotated (if not highlight the training phrase and annotate it manually):
                enter image description here
                and save the intent. Try it out by querying your agent with a X days back query.


              The JSON you receive from this payload will vary based on if the @sys.date entity was recognized or if the @Date entity you just created was recognized. The JSON payload for the 17 days back query that your webhook will receive looks like this:



              {
              "responseId": "1f67167c-8840-42ed-b3ed-420e2c2b1c43",
              "queryResult": {
              "queryText": "17 days back",
              "parameters": {
              "Date": "17 days"
              },
              "allRequiredParamsPresent": true,
              "fulfillmentMessages": [
              {
              "text": {
              "text": [
              ""
              ]
              }
              }
              ],
              "intent": {
              "name": "projects/anotheragent-c5ea8/agent/intents/6743e47a-8cb5-458d-b573-626d1a392a46",
              "displayName": "Date"
              },
              "intentDetectionConfidence": 1,
              "languageCode": "en"
              }
              }


              so you'll need to add some logic in your webhook to parse this date type in addition to the @sys.date type.






              share|improve this answer
























                3












                3








                3






                You cannot add to system entities (entities that start with @sys) but you can create your own composite date entity using a custom date unit entity (that includes "days back") and the system number entity:




                1. Create a new date-unit entity with the value days and the synonym days back:

                  and save the entity

                2. Create another entity called Date, uncheck the box for Define synonyms and enter @sys.number @date-unit for the value of the entity:
                  enter image description here
                  and save the entity

                3. Next add the X days back training example to an intent, which should be auto-annotated (if not highlight the training phrase and annotate it manually):
                  enter image description here
                  and save the intent. Try it out by querying your agent with a X days back query.


                The JSON you receive from this payload will vary based on if the @sys.date entity was recognized or if the @Date entity you just created was recognized. The JSON payload for the 17 days back query that your webhook will receive looks like this:



                {
                "responseId": "1f67167c-8840-42ed-b3ed-420e2c2b1c43",
                "queryResult": {
                "queryText": "17 days back",
                "parameters": {
                "Date": "17 days"
                },
                "allRequiredParamsPresent": true,
                "fulfillmentMessages": [
                {
                "text": {
                "text": [
                ""
                ]
                }
                }
                ],
                "intent": {
                "name": "projects/anotheragent-c5ea8/agent/intents/6743e47a-8cb5-458d-b573-626d1a392a46",
                "displayName": "Date"
                },
                "intentDetectionConfidence": 1,
                "languageCode": "en"
                }
                }


                so you'll need to add some logic in your webhook to parse this date type in addition to the @sys.date type.






                share|improve this answer












                You cannot add to system entities (entities that start with @sys) but you can create your own composite date entity using a custom date unit entity (that includes "days back") and the system number entity:




                1. Create a new date-unit entity with the value days and the synonym days back:

                  and save the entity

                2. Create another entity called Date, uncheck the box for Define synonyms and enter @sys.number @date-unit for the value of the entity:
                  enter image description here
                  and save the entity

                3. Next add the X days back training example to an intent, which should be auto-annotated (if not highlight the training phrase and annotate it manually):
                  enter image description here
                  and save the intent. Try it out by querying your agent with a X days back query.


                The JSON you receive from this payload will vary based on if the @sys.date entity was recognized or if the @Date entity you just created was recognized. The JSON payload for the 17 days back query that your webhook will receive looks like this:



                {
                "responseId": "1f67167c-8840-42ed-b3ed-420e2c2b1c43",
                "queryResult": {
                "queryText": "17 days back",
                "parameters": {
                "Date": "17 days"
                },
                "allRequiredParamsPresent": true,
                "fulfillmentMessages": [
                {
                "text": {
                "text": [
                ""
                ]
                }
                }
                ],
                "intent": {
                "name": "projects/anotheragent-c5ea8/agent/intents/6743e47a-8cb5-458d-b573-626d1a392a46",
                "displayName": "Date"
                },
                "intentDetectionConfidence": 1,
                "languageCode": "en"
                }
                }


                so you'll need to add some logic in your webhook to parse this date type in addition to the @sys.date type.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 at 15:14









                matthewayne

                2,599814




                2,599814






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394393%2frecognizing-4-days-back-using-sys-date%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin