node-stanford-postagger

A client for the Stanford Part of Speech Tagger XMLRPC server.

  • 所有者: cuzzo/node-stanford-postagger
  • 平台:
  • 許可證: BSD 2-Clause "Simplified" License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Node Stanford POS-tagger

Let your node.js application think like a human.

Usage

node-stanford-postagger has one usage, to interact with Stanford's POS-tagger.

Dependencies

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

Otherwise, carefully follow Stanford's and Turian's instructions. Be prepared to spend hours, = (Just get Docker).

Installation

git clone https://github.com/cuzzo/node-stanford-postagger
cd node-stanford-postagger
npm install

How to Run the XMLRPC Service

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.

Interacting with the XMLRPC Service in node.js

$ bin/tag "Hello, world!"
> [ 'Hello_UH ,_, world_NN !_.\n' ]

Interacting with the XMLRPC Service in Your node.js Project

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);
    }
  );

Acknowledgements

License

node-stanford-postagger is free--as in BSD. Hack your heart out, hackers.

  • NOTE: Stanford's POS Tagger itself is licensed GPL.

主要指標

概覽
名稱與所有者cuzzo/node-stanford-postagger
主編程語言JavaScript
編程語言Shell (語言數: 2)
平台
許可證BSD 2-Clause "Simplified" License
所有者活动
創建於2014-07-26 18:34:18
推送於2017-05-05 19:49:29
最后一次提交2017-05-05 12:49:28
發布數0
用户参与
星數72
關注者數5
派生數13
提交數19
已啟用問題?
問題數4
打開的問題數3
拉請求數2
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?