Hacker News new | ask | show | jobs
by hegivor 3690 days ago
Perhaps I am misunderstanding the example but isn't the date parsing result from the API documentation incorrect.

  nlp.value("I married April for the 2nd time on June 5th 1998 ").date()
  // [Date object]   d.toLocaleString() -> "04/2/1998"
https://github.com/nlp-compromise/nlp_compromise/blob/master...
3 comments

Maybe they want to show us the limitations? This makes it seem like they are not doing any fancy grammar parsing.
If you're looking for a library that could handle that sentence, check out https://github.com/neilgupta/sherlock :)

nlp-compromise definitely does way more, but in NLP, it helps to be domain-specific.

Does anyone know if there's an equivalent library in Python?
No, no one knows
I believe that is:

  nlp.text('No one knows.').people()[0].text
  'No one'
Was that sarcasm necessary?
No 4th or February in the string either... yet another example of how unambiguous date parsing in natural languages is very, very difficult. Also an example of why ISO-8601 is awesome.
Everyone always looks at me funny when I write my dates as `yyyy-mm-dd` - until, that is, I explain that it sorts alphabetically perfectly. That's the moment I can convert people to ISO-8601 converts.
I write dates that way too, but because mm/dd/yyy is ambiguous in an international context. Sorting correctly is great as well!
April 2nd.
That's the wrong date though. The person's name is April.
Yes, but you can still see how the model (mistakenly) arrives at this date
April = 4

2nd = 2