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

POS Tree #5

Closed PKuebler closed 5 years ago

PKuebler commented 7 years ago

Would it be possible to return the POS TREE next to the token?

jgontrum commented 7 years ago

What exactly do you mean by "POS Tree"? In general, each token has only one part-of-speech tag.

PKuebler commented 7 years ago

Sorry, I meant the dependency parser.

https://spacy.io/docs/usage/dependency-parse https://demos.explosion.ai/displacy/

as Json Tree?

[{
    token...
    modifiers: [{
        token...
    }]
}]
jgontrum commented 7 years ago

Ah yes, this is something I've also been thinking about for a while.

Representing the dependency tree as JSON seems to be a good idea, even though I would probably use the indices of the tokens there instead of the whole object to reduce redundancy. I'll see if I have time to implement it next weekend :)

PKuebler commented 7 years ago

Netflix API "Falcor" returns the objects and structure separately. In the structure, they reference only the IDs of the objects.

http://netflix.github.io/falcor/documentation/jsongraph.html

skerit commented 7 years ago

There's a Syntaxnet docker image that gives this information by adding a "head" property to each token, pointing to that token's parent token. Very easy for the receiving endpoint to create a tree out of, or just ignore it.