GithubHelp home page GithubHelp logo

node-stanford-simple-nlp's Introduction

node-stanford-simple-nlp

A simple node.js wrapper for Stanford CoreNLP.

What is Stanford CoreNLP?

Stanford CoreNLP provides a set of natural language analysis tools which can take raw English language text input and give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, and mark up the structure of sentences in terms of phrases and word dependencies, and indicate which noun phrases refer to the same entities. Stanford CoreNLP is an integrated framework, which make it very easy to apply a bunch of language analysis tools to a piece of text. Starting from plain text, you can run all the tools on it with just two lines of code. Its analyses provide the foundational building blocks for higher-level and domain-specific text understanding applications.

Stanford CoreNLP integrates all our NLP tools, including the part-of-speech (POS) tagger, the named entity recognizer (NER), the parser, and the coreference resolution system, and provides model files for analysis of English. The goal of this project is to enable people to quickly and painlessly get complete linguistic annotations of natural language texts. It is designed to be highly flexible and extensible. With a single option you can change which tools should be enabled and which should be disabled.

The Stanford CoreNLP code is written in Java and licensed under the GNU General Public License (v2 or later). Source is included. Note that this is the full GPL, which allows many free uses, but not its use in distributed proprietary software. The download is 214 MB and requires Java 1.6+.

Installation

node-stanford-simple-nlp depends on Standord CoreNLP v3.8.0. And don't forget to set proper environment variables like JAVA_HOME in your system.

$ npm install stanford-simple-nlp

Important! You should download stanford-corenlp-full-2017-06-09.zip file and unzip to the ./jar folder. You can download the file from here. This file couldn't be pushed to github & npm because of its too big size(about 214MB).

Usage

Async mode

var StanfordSimpleNLP = require('stanford-simple-nlp');

var stanfordSimpleNLP = new StanfordSimpleNLP.StanfordSimpleNLP( function(err) {
  stanfordSimpleNLP.process('This is so good.', function(err, result) {
    ...
  });
});

Sync mode

var StanfordSimpleNlp = require('stanford-simple-nlp');

var stanfordSimpleNLP = new StanfordSimpleNlp.StanfordSimpleNLP();
stanfordSimpleNLP.loadPipelineSync();
stanfordSimpleNLP.process('This is so good.', function(err, result) {
  ...
});

Warning! If you didn't initialize the class without callback function then you will meet 'Load a pipeline first.' error. So you have to do it with callback function or call loadPipeline(options, callback) function seperately.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

This license also applies to the included Stanford CoreNLP files.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author: Taeho Kim ([email protected]). Copyright 2013~2014.

Bitdeli Badge

node-stanford-simple-nlp's People

Contributors

bitdeli-chef avatar faizulhaque-tp avatar kareem1234 avatar xissy avatar zoellner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-stanford-simple-nlp's Issues

no suitable image found.

Hi,
I've got an error when running. Dos this have anything to do with the 32/64 bit architecture?

   /Users/[user]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:45: Error: dlopen(/Users/[user]/node_modules/stanford-simple-nlp/node_modules/java/build/Release/nodejavabridge_bindings.node, 1): no suitable image found.  Did find:

   /Users/[username]/node_modules/stanford-simple-nlp/node_modules/java/build/Release/nodejavabridge_bindings.node: mach-o, but wrong architecture
  Module._extensions[extension](this, filename);
                               ^
   Error: dlopen(/Users/[user]/node_modules/stanford-simple-nlp/node_modules/java/build/Release/nodejavabridge_bindings.node, 1): no suitable image found.  Did find:
/Users/[username]/node_modules/stanford-simple-nlp/node_modules/java/build/Release/nodejavabridge_bindings.node: mach-o, but wrong architecture
        at Module.load (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/java/lib/nodeJavaBridge.js:5:16)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/java/index.js:2:18)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
        at Function.Module._load (module.js:312:12)
 at Module.require (module.js:364:17)
 at require (module.js:380:17)
 at Object.<anonymous> (/Users/[username]/node_modules/stanford-simple-nlp/lib/StanfordSimpleNLP.coffee:1:8)
 at Object.<anonymous> (/Users/[username]/node_modules/stanford-simple-nlp/lib/StanfordSimpleNLP.coffee:1:1)
 at Module._compile (module.js:456:26)
 at Object.loadFile (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
 at Module.load (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
 at Function.Module._load (module.js:312:12)
 at Module.require (module.js:364:17)
 at require (module.js:380:17)
 at Object.<anonymous> (/Users/[username]/node_modules/stanford-simple-nlp/lib/index.coffee:3:22)
 at Object.<anonymous> (/Users/[username]/node_modules/stanford-simple-nlp/lib/index.coffee:2:1)
 at Module._compile (module.js:456:26)
 at Object.loadFile (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
 at Module.load (/Users/[username]/node_modules/stanford-simple-nlp/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
 at Function.Module._load (module.js:312:12)
 at Module.require (module.js:364:17)
 at require (module.js:380:17)
 at Object.<anonymous> (/Users/[username]/node_modules/stanford-simple-nlp/index.js:7:18)
 at Module._compile (module.js:456:26)
 at Object.Module._extensions..js (module.js:474:10)
 at Module.load (module.js:356:32)
 at Function.Module._load (module.js:312:12)
 at Module.require (module.js:364:17)
 at require (module.js:380:17)
        at <string>:1:25

Support for CoreNLP 3.6.0 (12/09/2015) release

stanford-corenlp-full-2014-01-04.zip works great. The newest build (http://nlp.stanford.edu/software/stanford-corenlp-full-2015-12-09.zip) throws errors:

Stanford CoreNLP error? { [Error: Could not find class edu.stanford.nlp.pipeline.StanfordCoreNLP
java.lang.NoClassDefFoundError: edu/stanford/nlp/pipeline/StanfordCoreNLP
Caused by: java.lang.ClassNotFoundException: edu.stanford.nlp.pipeline.StanfordCoreNLP
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
] cause: {} }

Uncaught TypeError

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

basic-dependencies

I need only basic-dependencies as json object.I don't need other dependencies like collapsed-dependencies,collapsed-ccprocessed-dependencies are required.How can i do that?

Parsing ideas

Has anyone here came up with a way to parse the string result that you get from result.document.sentences.sentence.parse? With the one in the example you would get this '(ROOT (S (NP (DT This)) (VP (VBZ is) (ADJP (RB so) (JJ good))) (. .))) ' (which compared to other ones is still a very simple one). Now I'm trying to write a parser function so that I can build further logic on top of the result.

Doc issues

  1. Readme

    var options = {
    annotators: ['tokenize', 'ssplit', 'pos', 'lemma', 'ner', 'parse' 'dcoref']
    };

Should be

var options = {
  annotators: ['tokenize', 'ssplit', 'pos', 'lemma', 'ner', 'parse', 'dcoref']
};
  1. jar folder should say to move the JAR files in, not just unzip the archive into the jar folder.

Failed at the [email protected] install script 'node-gyp rebuild'

Getting lots of these sort of errors errors:
./src/java.h:23:42: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
static v8::Handlev8::Value New(const v8::Arguments& args);
^~~~~~~~~~~~~
v8::internal::Arguments

This is on OSX Yosemite 10.10.4 with node version 0.12.7

Thanks

read me mistake?

With regards to this code sample... On the first var StanfordSimpleNlp has lower case lp at the end. The next line new StanfordSimpleNLP has upper case LP. Shouldn't they match?

var StanfordSimpleNlp = require('stanford-simple-nlp');

var stanfordSimpleNLP = new StanfordSimpleNLP.StanfordSimpleNLP();

Cannot open include file: 'jni.h'

I'm looking to experiment with this repo but I'm having issues getting it running.

OS: Widows 10 (64 bit)
node: v7.10.0 (64 bit)
npm: v5.3.0
node-gyp: v3.6.2
java: v1.8.0_144 (32 bit)
python: v2.7.13 (32 bit)

When I run npm install --save stanford-simple-nlp in C:\Users\bridgs\repos\nlp-schtuff I get:

> node-gyp rebuild

C:\Users\bridgs\repos\nlp-schtuff\node_modules\java>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\no
de_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Warning: Missing input files:
C:\Program Files (x86)\Java\jdk1.8.0_144\;C:\Program Files (x86)\Java\jdk1.8.0_144\bin\;\include\win32\jni_md.h
C:\Program Files (x86)\Java\jdk1.8.0_144\;C:\Program Files (x86)\Java\jdk1.8.0_144\bin\;\lib\jvm.lib
C:\Program Files (x86)\Java\jdk1.8.0_144\;C:\Program Files (x86)\Java\jdk1.8.0_144\bin\;\include\jni.h
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Verify Deps
  Verify Deps
  Verify Deps
  java.cpp
  javaObject.cpp
  javaScope.cpp
  methodCallBaton.cpp
c:\users\bridgs\repos\nlp-schtuff\node_modules\java\src\javaScope.h(5): fatal error C1083: Cannot open include file: 'j
ni.h': No such file or directory (compiling source file ..\src\javaScope.cpp) [C:\Users\bridgs\repos\nlp-schtuff\node_m
odules\java\build\nodejavabridge_bindings.vcxproj]
  nodeJavaBridge.cpp
c:\users\bridgs\repos\nlp-schtuff\node_modules\java\src\utils.h(7): fatal error C1083: Cannot open include file: 'jni.h
': No such file or directory (compiling source file ..\src\methodCallBaton.cpp) [C:\Users\bridgs\repos\nlp-schtuff\node
_modules\java\build\nodejavabridge_bindings.vcxproj]
c:\users\bridgs\repos\nlp-schtuff\node_modules\java\src\javaObject.h(7): fatal error C1083: Cannot open include file: '
jni.h': No such file or directory (compiling source file ..\src\javaObject.cpp) [C:\Users\bridgs\repos\nlp-schtuff\node
_modules\java\build\nodejavabridge_bindings.vcxproj]
c:\users\bridgs\repos\nlp-schtuff\node_modules\java\src\java.h(7): fatal error C1083: Cannot open include file: 'jni.h'
: No such file or directory (compiling source file ..\src\java.cpp) [C:\Users\bridgs\repos\nlp-schtuff\node_modules\jav
a\build\nodejavabridge_bindings.vcxproj]
  utils.cpp
  win_delay_load_hook.cc
c:\users\bridgs\repos\nlp-schtuff\node_modules\java\src\java.h(7): fatal error C1083: Cannot open include file: 'jni.h'
: No such file or directory (compiling source file ..\src\nodeJavaBridge.cpp) [C:\Users\bridgs\repos\nlp-schtuff\node_m
odules\java\build\nodejavabridge_bindings.vcxproj]
c:\users\bridgs\repos\nlp-schtuff\node_modules\java\src\utils.h(7): fatal error C1083: Cannot open include file: 'jni.h
': No such file or directory (compiling source file ..\src\utils.cpp) [C:\Users\bridgs\repos\nlp-schtuff\node_modules\j
ava\build\nodejavabridge_bindings.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:2
58:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\bridgs\repos\nlp-schtuff\node_modules\java
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Anyone have any thoughts?

heap problem

how to increase size of heap i am stuck to java.options.push '-Xmx500m'.If i try to increase it give me error "Could not reserve enough space for object heap"

loadPipeline Initialization

I see there has been a recent change in the description of Async vs Sync. This is a great step foreword.

However, for me, The code example for the Async mode still reports 'Load a pipeline first'. Also the Warning has an effective double negative "didn't" and "without" which is a bit confusing with respect to both examples..

Respectfully...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.