Time: don't parse at + phone number

Summary: Fixes #95.

Reviewed By: blandinw

Differential Revision: D6129893

fbshipit-source-id: e863021
This commit is contained in:
Julien Odent 2017-10-23 16:16:03 -07:00 committed by Facebook Github Bot
parent 1ade1935b2
commit 980c0f279e
3 changed files with 4 additions and 1 deletions

View File

@ -90,6 +90,8 @@ negativeCorpus = (testContext, examples)
, "rat 6"
, "3 30"
, "three twenty"
, "at 650.650.6500"
, "at 650-650-6500"
]
allExamples :: [Example]

View File

@ -505,7 +505,7 @@ ruleHHMMLatent :: Rule
ruleHHMMLatent = Rule
{ name = "hhmm (latent)"
, pattern =
[ regex "((?:[01]?\\d)|(?:2[0-3]))([0-5]\\d)"
[ regex "((?:[01]?\\d)|(?:2[0-3]))([0-5]\\d)(?!.\\d)"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:_)):_) -> do

View File

@ -102,4 +102,5 @@ intersectTests = testCase "Intersect Test" $
xs = [ ("tomorrow July", 2)
, ("Mar tonight", 2)
, ("Feb tomorrow", 1) -- we are in February
, ("at 615.", 1) -- make sure ruleHHMMLatent allows this
]