jgontrum / spacy-api-docker

spaCy REST API, wrapped in a Docker container.
https://hub.docker.com/r/jgontrum/spacyapi/
MIT License
265 stars 99 forks source link

Adding a new entry point for POS tagger only output #21

Open oterrier opened 5 years ago

oterrier commented 5 years ago

Hi, I'm thinking in adding a new entry point /tag to retrieve a result of the POS tagging of a document with detailed output for each token. My basic idea is to accept a json request with the following body:

{
text : "text",
model: "model",
include_sentences : true|false, #include a sentence level or not in the output
attr_filter : [ ] #list of token attributes to include in the output, like ["lemma", "pos", ... "is_stop", ...]
}

The output could be a list of tokens like: [ { text : "text", start : 111, end : 222, lemma : "lemma", ... } , {}, .. , ]

with eventually an additionnal sentence level like:

[
 { text : "sentence text", start : 0, end : 100000, tokens : [ {}, ... {}] },
...
]

What do you think ? I need something like that to use spacy from a java program

Best regards

Olivier