Skip to main content

Python bindings for Stanford CoreNLP protobufs

Project description

https://travis-ci.org/stanfordnlp/python-corenlp-protobuf.svg?branch=master

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.

Files for corenlp-protobuf, version 3.8.0
Filename, size File type Python version Upload date Hashes
Filename, size corenlp_protobuf-3.8.0-py2.py3-none-any.whl (15.2 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size corenlp-protobuf-3.8.0.tar.gz (19.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page