Skip to content

Is there a way parse a date and duration at the same time? #1119

Answered by spencermountain
eden-lane asked this question in Q&A
Discussion options

You must be logged in to vote

hey eden lane, sure it's possible to do both, depending on what you're looking for.
There's nothing wrong with calling both methods on the document:

let doc = nlp('tomorrow at 12:30 for 30 minutes')
let res1 = doc.durations().json()
let res2 = doc.dates().json()

//or alternatively, if you wanted to drill-down
let m =  doc.dates()
let res1 = m.json()
let res2 = m.durations().json()

let me know if that helps, cheers

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eden-lane
Comment options

Answer selected by eden-lane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants