Is there a way parse a date and duration at the same time? #1119
-
As I see, methods are not chainable, so I can't do something like this: compromise('tomorrow at 12:30 for 30 minutes').dates().durations().get() Is there a way to do it right? |
Beta Was this translation helpful? Give feedback.
Answered by
spencermountain
Jun 20, 2024
Replies: 1 comment 1 reply
-
hey eden lane, sure it's possible to do both, depending on what you're looking for. 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 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
eden-lane
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 me know if that helps, cheers