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

Date rule doesn't match well with action #776

Open
kwalcock opened this issue Jan 22, 2024 · 3 comments
Open

Date rule doesn't match well with action #776

kwalcock opened this issue Jan 22, 2024 · 3 comments

Comments

@kwalcock
Copy link
Member

The rule

- name: date-range-10
  priority: ${rulepriority}
  label: DateRange
  type: token
  example: "First two weeks of May"
  action: mkDateRangeMentionWithWeek
  pattern: |
    (?<week> /(?i)(first|second|last)/ /(?i)two/ /(?i)weeks/) /(?i)of/ @month:PossibleMonth

gets processed by

  private def getWeekRange(weekNormalizer: WeekNormalizer)(argName: String, m:Mention): Option[WeekRange] = {
    val wordsOpt = getArgWords(argName, m)

    if (wordsOpt.isEmpty) None
    else if (wordsOpt.get.mkString(" ").toLowerCase().equals("last week")) {getLastWeekRange(m)}
    else if (wordsOpt.get.mkString(" ").toLowerCase().equals("last two weeks")) {getLastTwoWeeksRange(m)}
    else weekNormalizer.norm(wordsOpt.get)
  }

and doesn't take the possibility of "last weeks [of June]" into account. An internal exception is eventually thrown and also swallowed. weekNormalizer.norm doesn't take care of it, either, because WeekNormalizer.normMapper doesn't have third weeks.

The code should account for any match of the rule and vice versa.

@MihaiSurdeanu
Copy link
Contributor

Thanks @kwalcock !
I will handle this.

@kwalcock
Copy link
Member Author

The text seems to come from this conversation, which is surprisingly even grammatical. Perhaps third can be added as well.

And that's a good point. I think I missed sorghum planting. When are you guys trying to get that in \n\nRight <laugh>? Um, it looks like between the second and third weeks of June.

@MihaiSurdeanu
Copy link
Contributor

Addressed in PR #777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants