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 & hash File type Python version Upload date
corenlp_protobuf-3.8.0-py2.py3-none-any.whl (15.2 kB) View hashes Wheel 2.7
corenlp-protobuf-3.8.0.tar.gz (19.4 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page