xissy / node-stanford-simple-nlp

A simple node.js wrapper for stanford-core-nlp.
Other
148 stars 44 forks source link

Uncaught TypeError #3

Closed silentrob closed 10 years ago

silentrob commented 10 years ago

Just followed the instructions and Im seeing, but I don't have a line 2766 (Love CoffeeScript)

stanford-simple-nlp/lib/StanfordSimpleNLP.coffee:2766: Uncaught TypeError: undefined is not a function

xissy commented 10 years ago

Hey @silentrob, can you give more hints? Just writing your code here will be great.

silentrob commented 10 years ago

I just copied/paste the demo from the readme.. Ill give you a complete gist. node v0.10.24, Mountain:stanfordnlp robellis$ java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

silentrob commented 10 years ago

https://gist.github.com/silentrob/9945896

silentrob commented 10 years ago

It happens with any option.

xissy commented 10 years ago

Unfortunately, I couldn't meet the Uncaught TypeError.

But I updated to use coffee-script 1.7.1 from 1.6.x and StanfordNLP 3.3.1 from 3.3.0 and stanford-simple-nlp was bumped to version 0.2.1.

You may see a more informed error now.

So, follow below steps.

  1. Reinstall it by `npm i stanford-simple-nlp@0.2.1'
  2. Download StanfordNLP 3.3.1 instead of 3.3.0, unzip & copy & paste it to your jar/ directory.
  3. Test it again and let me know the result please.

Thanks.

silentrob commented 10 years ago

Awesome. I will try it again.

silentrob commented 10 years ago

This is the trace now.

/Users/robellis/projects/stanfordnlp/node_modules/stanford-simple-nlp/lib/StanfordSimpleNLP.coffee:80 return callback(new Error('Load a pipeline first.')); ^ TypeError: undefined is not a function at StanfordSimpleNLP.process (/Users/robellis/projects/stanfordnlp/node_modules/stanford-simple-nlp/lib/StanfordSimpleNLP.coffee:69:12) at /Users/robellis/projects/stanfordnlp/server.js:8:21 at /Users/robellis/projects/stanfordnlp/node_modules/stanford-simple-nlp/lib/StanfordSimpleNLP.coffee:54:18

silentrob commented 10 years ago

I should be using the process method the same was as your test. process("...", function(err, res){});

silentrob commented 10 years ago

Okay I got it. You can't just call pares you need to call tokenize, ssplit and pos first. Java was returning an error and I think it was getting though and unsetting the callback.

xissy commented 10 years ago

Oh, I see. now then I can reproduce the problem. I'll fix it properly, thanks @silentrob!

xissy commented 10 years ago

modified unclear examples - 8fef978c5e581f46045ce52f19314fc0d0976cb0