mirror of
https://github.com/facebook/duckling.git
synced 2024-11-28 16:54:59 +03:00
Url: handle fragments
Summary: https://github.com/facebook/duckling/issues/155 Reviewed By: JonCoens Differential Revision: D6967145 fbshipit-source-id: 44e573b57c714a62d93d74063f597d31feb8c6f5
This commit is contained in:
parent
1f7290880c
commit
c7fb533a67
@ -70,4 +70,13 @@ allExamples = concat
|
|||||||
, examples (UrlData "aMaZon.co.uk/?page=home" "amazon.co.uk")
|
, examples (UrlData "aMaZon.co.uk/?page=home" "amazon.co.uk")
|
||||||
[ "aMaZon.co.uk/?page=home"
|
[ "aMaZon.co.uk/?page=home"
|
||||||
]
|
]
|
||||||
|
, examples (UrlData "https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax" "en.wikipedia.org")
|
||||||
|
[ "https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax"
|
||||||
|
]
|
||||||
|
, examples (UrlData "http://example.com/data.csv#cell=4,1-6,2" "example.com")
|
||||||
|
[ "http://example.com/data.csv#cell=4,1-6,2"
|
||||||
|
]
|
||||||
|
, examples (UrlData "http://example.com/bar.webm#t=40,80&xywh=160,120,320,240" "example.com")
|
||||||
|
[ "http://example.com/bar.webm#t=40,80&xywh=160,120,320,240"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
@ -24,7 +24,7 @@ ruleURL :: Rule
|
|||||||
ruleURL = Rule
|
ruleURL = Rule
|
||||||
{ name = "url"
|
{ name = "url"
|
||||||
, pattern =
|
, pattern =
|
||||||
[ regex "((([a-zA-Z]+)://)?(w{2,3}[0-9]*\\.)?(([\\w_-]+\\.)+[a-z]{2,4})(:(\\d+))?(/[^?\\s#]*)?(\\?[^\\s#]+)?)"
|
[ regex "((([a-zA-Z]+)://)?(w{2,3}[0-9]*\\.)?(([\\w_-]+\\.)+[a-z]{2,4})(:(\\d+))?(/[^?\\s#]*)?(\\?[^\\s#]+)?(#[\\-,*=&a-z0-9]+)?)"
|
||||||
]
|
]
|
||||||
, prod = \tokens -> case tokens of
|
, prod = \tokens -> case tokens of
|
||||||
(Token RegexMatch (GroupMatch (m:_:_protocol:_:domain:_:_:_port:_path:_query:_)):
|
(Token RegexMatch (GroupMatch (m:_:_protocol:_:domain:_:_:_port:_path:_query:_)):
|
||||||
|
Loading…
Reference in New Issue
Block a user