Let your node.js application think like a human.
node-stanford-postagger has one usage, to interact with Stanford's POS-tagger.
To simply configure and install Stanford's POS-tagger with Turian's XMLPRC service, you can simply run my Stanford POS-tagger Docker image:
docker pull cuzzo/stanford-pos-tagger
docker run -t -i -p 9000:9000 cuzzo/stanford-pos-tagger
- Get Docker - It's just a few commands away.
Otherwise, carefully follow Stanford's and Turian's instructions. Be prepared to spend hours |= (Just get Docker).
git clone https://github.com/cuzzo/node-stanford-postagger
cd node-stanford-postagger
npm install
As posted above, with Docker, it's as simple as:
docker pull cuzzo/stanford-pos-tagger
docker run -t -i -p 9000:9000 cuzzo/stanford-pos-tagger
Without Docker, I've included util/run-server.sh
to simplify running Turian's XMLRPC service for Stanford's POS-tagger in a user-friendly way.
run-server.sh models/left3words-wsj-0-18.tagger 9000
The above runs the service using the built-in left3words-wsj-0-18
training model on port 9000
. To run this script, it's required to live in the root directory of the stanford-postagger code--in the same directory as Turian's tagger-server.jar
is required to be moved.
$ bin/tag "Hello, world!"
> [ 'Hello_UH ,_, world_NN !_.\n' ]
var Tagger = require("node-stanford-postagger/postagger").Tagger;
var tagger = new Tagger({
port: "9000",
host: "localhost"
});
tagger.tag("Hello, world!", function(err, resp) {
if (err) return console.error(err);
console.log(resp);
});
If you don't like callbacks and prefer promises, node-stanford-postagger supports denodeify
.
var Q = require("q");
var Tagger = require("node-stanford-postagger/postagger").Tagger;
var tagger = new Tagger({
port: "9000",
host: "localhost"
});
tagger.denodify(Q);
tagger.tag("Hello, world!")
.then(function(resp) {
console.log(resp);
},
function(err) {
console.error(err);
}
);
- Ali Afshar's XMLRPC service for Stanford's POS-tagger - This node.js client wouldn't exist without it.
- The geniuses at Stanford - These guys were and are truly pioneering. This software gets the part of speech right 90% of the time, even when the word is unknown!
node-stanford-postagger is free--as in BSD. Hack your heart out, hackers.
- NOTE: Stanford's POS Tagger itself is licensed GPL.