Python bindings for Stanford CoreNLP protobufs
Project description
This package contains python bindings for Stanford CoreNLP’s protobuf specifications, as generated by protoc. These bindings can used to parse binary data produced by, e.g., the Stanford CoreNLP server.
Usage:
from corenlp_protobuf import Document, parseFromDelimitedString
# document.dat contains a serialized Document.
with open('document.dat', 'r') as f:
buf = f.read()
doc = Document()
parseFromDelimitedString(doc, buf)
# You can access the sentences from doc.sentence.
sentence = doc.sentence[0]
# You can access any property within a sentence.
print(sentence.text)
# Likewise for tokens
token = sentence.token[0]
print(token.lemma)
See test_read.py for more examples.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
corenlp-protobuf-3.7.2.tar.gz
(19.4 kB
view hashes)
Built Distribution
Close
Hashes for corenlp_protobuf-3.7.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 513fbf627c7036409ba2a82c96c426a4ef5895b1eb0ec06d74757527eb9112d0 |
|
MD5 | 471e73a1245cc9fcfc441b3ba8305392 |
|
BLAKE2b-256 | 9098ed479c91e9676ee7f06bbfd30f66c3b697ccdd8934df0842d3efd11647a7 |