Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EN DateTime V2] Handling cases like "April ninth through 15th" #2905

Closed
srinath-ragh opened this issue Mar 15, 2022 · 1 comment
Closed
Labels

Comments

@srinath-ragh
Copy link
Contributor

srinath-ragh commented Mar 15, 2022

Describe the bug
"number (with oridnals)" through "number" seems to work, however, "ordinal word (first, second etc.) for number" through "number" does not. See examples below. (Also consider internationalization)

To Reproduce
Steps to reproduce the behavior:

  1. Run sample console
  2. Try "i am off april ninth through 17th"
  3. Resolution does not include datetimeV2.daterange for the corresponding period

Expected behavior
Expected following entity to be present in the response

{
  "Text": "april ninth thru 17th",
  "Start": 9,
  "End": 33,
  "TypeName": "datetimeV2.daterange",
  "Resolution": {
    "values": [
      {
        "timex": "(XXXX-04-09,XXXX-04-17,P8D)",
        "type": "daterange",
        "start": "2021-04-09",
        "end": "2021-04-17"
      },
      {
        "timex": "(XXXX-04-09,XXXX-04-17,P8D)",
        "type": "daterange",
        "start": "2022-04-09",
        "end": "2022-04-17"
      }
    ]
  }
}

Sample input/output

(WORKS)
Enter the text to recognize:
i'll be off 10th thru 15th this month

I found the following entities (3):
{
  "Text": "10th",
  "Start": 12,
  "End": 15,
  "TypeName": "ordinal",
  "Resolution": {
    "offset": "10",
    "relativeTo": "start",
    "value": "10"
  }
}
{
  "Text": "15th",
  "Start": 22,
  "End": 25,
  "TypeName": "ordinal",
  "Resolution": {
    "offset": "15",
    "relativeTo": "start",
    "value": "15"
  }
}
{
  "Text": "10th thru 15th this month",
  "Start": 12,
  "End": 36,
  "TypeName": "datetimeV2.daterange",
  "Resolution": {
    "values": [
      {
        "timex": "(2022-03-10,2022-03-15,P5D)",
        "type": "daterange",
        "start": "2022-03-10",
        "end": "2022-03-15"
      }
    ]
  }
}

(WORKS)
Enter the text to recognize:
i'll be off april 10th through 15th

I found the following entities (4):
{
  "Text": "10th",
  "Start": 18,
  "End": 21,
  "TypeName": "ordinal",
  "Resolution": {
    "offset": "10",
    "relativeTo": "start",
    "value": "10"
  }
}
{
  "Text": "15th",
  "Start": 31,
  "End": 34,
  "TypeName": "ordinal",
  "Resolution": {
    "offset": "15",
    "relativeTo": "start",
    "value": "15"
  }
}
{
  "Text": "10th through 15th",
  "Start": 18,
  "End": 34,
  "TypeName": "numberrange",
  "Resolution": {
    "value": "[10,15)"
  }
}
{
  "Text": "april 10th through 15th",
  "Start": 12,
  "End": 34,
  "TypeName": "datetimeV2.daterange",
  "Resolution": {
    "values": [
      {
        "timex": "(XXXX-04-10,XXXX-04-15,P5D)",
        "type": "daterange",
        "start": "2021-04-10",
        "end": "2021-04-15"
      },
      {
        "timex": "(XXXX-04-10,XXXX-04-15,P5D)",
        "type": "daterange",
        "start": "2022-04-10",
        "end": "2022-04-15"
      }
    ]
  }
}

(DOES NOT WORK)
Enter the text to recognize: 
i am off april ninth through 17th

I found the following entities (4):
{
  "Text": "ninth",
  "Start": 15,
  "End": 19,
  "TypeName": "ordinal",
  "Resolution": {
    "offset": "9",
    "relativeTo": "start",
    "value": "9"
  }
}
{
  "Text": "17th",
  "Start": 29,
  "End": 32,
  "TypeName": "ordinal",
  "Resolution": {
    "offset": "17",
    "relativeTo": "start",
    "value": "17"
  }
}
{
  "Text": "ninth through 17th",
  "Start": 15,
  "End": 32,
  "TypeName": "numberrange",
  "Resolution": {
    "value": "[9,17)"
  }
}
{
  "Text": "april ninth",
  "Start": 9,
  "End": 19,
  "TypeName": "datetimeV2.date",
  "Resolution": {
    "values": [
      {
        "timex": "XXXX-04-09",
        "type": "date",
        "value": "2021-04-09"
      },
      {
        "timex": "XXXX-04-09",
        "type": "date",
        "value": "2022-04-09"
      }
    ]
  }
}

Platform (please complete the following information):

  • Platform: .NET
  • Environment: Console App
  • Version of package v1.3.2
@hazemelh hazemelh added the Priority:P1 Priority 1 Issue label Jun 13, 2022
@aitelint
Copy link
Contributor

working on this

aitelint pushed a commit to aitelint/Recognizers-Text that referenced this issue Jun 21, 2022
tellarin pushed a commit that referenced this issue Jul 13, 2022
…th" (#2905) (#2994)

* Added support for cases like "April ninth through 15th" (#2905)

* Modified fix to use regexes instead of OrdinalExtractor according to review

* Removed DateContext modifications

* Corrected bug in Hindi Ordinal extraction

Co-authored-by: aitelint <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants