News for hackers. Stuff that matters.
Re:A cool way to use natural language in JavaScript by oori on Saturday May 14, 2016 @09:02AM (#11695919)

  nlp.statement('She sells seashells').negate().text()
  // She doesn't sell seashells

  nlp.sentence('I fed the dog').replace('the [Noun]', 'the cat').text()
  // I fed the cat

  nlp.text("Tony Hawk did a kickflip").people();
  // [ Person { text: 'Tony Hawk' ..} ]
Re:A cool way to use natural language in JavaScript by gcr on Saturday May 14, 2016 @09:40AM (#11696063)
Thanks for writing this comment. I can't think of a better way to describe what this library does than reading these super simple examples.
Re:A cool way to use natural language in JavaScript by geon on Monday May 16, 2016 @01:44PM (#11708047)
Check out the docs. It is chock full of them.

https://github.com/nlp-compromise/nlp_compromise/blob/master...

Re:A cool way to use natural language in JavaScript by stephenr on Saturday May 14, 2016 @02:16PM (#11697366)
Does the same thing work if the name is lowercase?

Stanford nlp won't recognise "I want to go to sydney" with a location because it expects proper nouns to be capitalised for places (and other similar named entities I believe). I tried to make their case less models work but a lack of time and patience resulted in a more specific fix for what we needed.

Re:A cool way to use natural language in JavaScript by atomwaffel on Saturday May 14, 2016 @06:05PM (#11698263)

  > nlp.text('i want to go to sydney.').places()[0].city
  'Sydney'

  > nlp.text('tony hawk did a kickflip.').people()[0].text
  'tony'
So in the first case, it clearly does recognise that Sydney is a city independent of capitalisation. In the second case, it does recognise the first name but not the last, instead tagging "hawk" as a noun. The same happens with "john smith", however "john thomas" is recognised as a full name.
Re:A cool way to use natural language in JavaScript by mpjme on Sunday May 15, 2016 @06:28AM (#11700306)
To be fair, I think that my grandmother, not familiar with gaming/skating celebs, would tag it the same way.
Re:A cool way to use natural language in JavaScript by PantaloonFlames on Saturday May 14, 2016 @07:28PM (#11698531)
Thanks. Why don't more people write docs like this, leading with examples?
Re:A cool way to use natural language in JavaScript by WhoIsSatoshi on Saturday May 14, 2016 @10:19PM (#11699071)
It's called README file. It would blink if it could.
Re:A cool way to use natural language in JavaScript by lilgreenland on Saturday May 14, 2016 @06:28PM (#11698335)
I added this to an example chatbot lesson I made for a high school intro CS class.

http://codepen.io/lilgreenland/pen/zqXLeJ?editors=0010

Re:A cool way to use natural language in JavaScript by lilgreenland on Saturday May 14, 2016 @06:45PM (#11698399)
can anyone think of some other cool tricks I can do with this to show my class on Monday?
Re:A cool way to use natural language in JavaScript by huj123 on Sunday May 15, 2016 @03:05AM (#11699841)
Look up example questions for the Loebner Prize, and see if you can tweak your bot to answer some of them.