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

Update rules to allow more variation for MonthDDDD intervals. #271

Closed
wants to merge 2 commits into from

Conversation

MorrisLaw
Copy link
Contributor

Fixes #218

Note: This is still a work in progress. But, I'm new to both Haskell and this repo and I seem to be stuck. Would appreciate feedback on what I've done so far. Thank you!

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@@ -1118,6 +1118,30 @@ ruleIntervalFromDDDDMonth = Rule
_ -> Nothing
}

ruleIntervalFromDDDDOfMonth :: Rule
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this rule because it was failing too early when trying to add "of" in the above rule.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right way to go. ruleIntersectOf might get in the way when disambiguating but adding more corpus examples should help. Make sure to re-generate the classifiers with the latest code and include them in the commit.

@@ -958,6 +958,10 @@ allExamples = concat
, "from July 13-15"
, "from 13 to 15 July"
, "from 13th to 15th July"
, "from the 13th to 15th July"
, "from the 13th to the 15th July"
, "from the 13th to the 15th of July"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fails here. Trying to figure out what I'm doing wrong in the rule.

, Predicate isDOMValue
, regex "\\-|to( the)?|th?ru|through|(un)?til(l)?"
, Predicate isDOMValue
, regex "of"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, I am unable to get this to work for "of".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because when pattern matching tokens in the production rule, you're missing the new regex match token.

token1:
_:
token2:
Token Time td:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Token Time td:
_:
Token Time td:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was it. Thank you @patapizza for spotting that. Makes a lot more sense now 👍

@MorrisLaw MorrisLaw changed the title (WIP) Update rules to allow more variation for MonthDDDD intervals. Update rules to allow more variation for MonthDDDD intervals. Nov 14, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patapizza has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@patapizza
Copy link
Contributor

Thank you @MorrisLaw!

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

Successfully merging this pull request may close these issues.

3 participants