question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

date.parse() in nlp_core

See original GitHub issue

I tried all the readme examples, and I got very mixed results. Did something in the library break or am I doing something wrong?

nlp.text('She sells seashells').to_past()
// An array containing the object shown below. Object contains text from original string.

screenshot 2016-04-14 14 31 39

nlp.noun("dinosaur").pluralize();
// This works

nlp.verb("speak").conjugate();
// This works

nlp.text('She sells seashells').negate()
// Same issue as above

nlp.sentence('I fed the dog').replace('the [Noun]', 'the cat')
// Same issue as above

nlp.text("Tony Hawk did a kickflip").people();
// This works

nlp.person("Tony Hawk").article();
// "a" instead of "he" 

nlp.value("five hundred and sixty").number;
// This works

I’m using Chrome Version 49.0.2623.112 (64-bit) on OS X I got the same results in Node.js 5.10.1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Jun 16, 2016

hey KahWee, yeah, this is the softest part of nlp_compromise by a long shot. That’s a great, (and brutal!) example 😉

So for sure it should remain an array of results, you can mention two independent dates per sentence, but the result format is pretty lame.

My intention with the format was to support strings like "in june", without assuming a particular year, likewise for hour/second/etc information - returning a date object forces choices about which year/second it is, even when you don’t have information about it.

The second thing is date intervals, like "june 5th to 6th", which i originally supported but stepped-back from.

The third thing is repeating dates, like "every tuesday", which needs some kind of result format that respects the wonky calendar-systems, leap-years etc.

So you can see how limp-wristed the date-parsing method, and result-format is in current form. What it is good at though, is identifying which part of a text is a date. Maybe date.parse() should be removed completely, or created as a plugin, or something like this. I just added a URL.parse() method with the same feel, so maybe we’re onto something.

Anybody with ideas or ambitious with this, that’d be sweet cheers!

1reaction
stanonyimecommented, May 14, 2016

On Chrome, i’m getting errors on:

nlp.value("I married April for the 2nd time on June 5th 1998 ").date()

The error is:

VM235:1 Uncaught TypeError: nlp.value(...).date is not a function
Read more comments on GitHub >

github_iconTop Results From Across the Web

SUTime custom date parsing - stanford nlp - Stack Overflow
Need to parse a sentence like "Bob was born on Jan fifteen nineteen seventy nine." and extract the date. How do I create...
Read more >
SUTime - CoreNLP - Stanford NLP Group
Running SUTime in a Stanford CoreNLP Pipeline​​ Use a tab-delimited file to specify doc dates. First column is document ID, second column is...
Read more >
Date.parse() - JavaScript - MDN Web Docs
The Date.parse() method parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or...
Read more >
Parser FAQ - The Stanford Natural Language Processing Group
How can the PCFG parser produce typed dependency parses? Why if I use the getBestDependencyParse() method do I get null or an untyped...
Read more >
JavaScript Date parse() Method - W3Schools
parse() parses a date string and returns the time difference since January 1, 1970. parse() returns the time difference in milliseconds.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found