https://github.com/tani/morenlp
JSON-RPC server for Stanford CoreNLP
https://github.com/tani/morenlp
Last synced: 9 months ago
JSON representation
JSON-RPC server for Stanford CoreNLP
- Host: GitHub
- URL: https://github.com/tani/morenlp
- Owner: tani
- License: mit
- Created: 2020-11-19T10:53:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-13T20:53:29.000Z (over 1 year ago)
- Last Synced: 2025-02-05T16:49:04.753Z (11 months ago)
- Language: Clojure
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# MoreNLP
We can retrieve constituent structure of the sentence by CoreNLP Server.
It however is not JSON friendly, like S-expression.
You can call `edu.stanford.nlp.pipeline.StanfordCoreNLP.process` via JSON-RPC 2.0 by this software and retrieve nice JSON.
## Usage
### JSON-RPC
```sh
$ PORT=8888 lein ring server-headless # or PORT=8888 java -jar morenlp--standalone.jar
$ curl -X POST -H 'application/json' -d '{"jsonrpc":"2.0", "id":"0000-0000-0000", "method": "process", "params": ["Hello world."]}'
$ curl -X POST -H 'application/json' -d '{"jsonrpc":"2.0", "id":"0000-0000-0000", "method": "process", "params": ["Hello world.", {"annotators": "tokenize,ssplit,pos,lemma,ner,parse"}]}'
$ curl -X POST -H 'application/json' -d '{"jsonrpc":"2.0", "id":"0000-0000-0000", "method": "process", "params": ["Hello world.", {"annotators": "tokenize,ssplit,pos,lemma,ner,parse", "parse.binaryTrees": "true"}]}'
```
### Clojure REPL
```clojure
$ lein repl
morenlp.core > (process "Hello world.")
morenlp.core > (process "Hello world." {"annotators" "tokenize,ssplit,pos,lemma,ner,parse"})
morenlp.core > (process "Hello world." {"annotators" "tokenize,ssplit,pos,lemma,ner,parse" "parse.binaryTrees" "true"})
```
## License
Copyright (c) 2020 TANIGUCHI Masaya All Rights Reserved.
This software is licensed under the MIT license.