Welcome to CoreNLP XML Library’s documentation! — CoreNLP XML Library 0.0.1 documentation (original) (raw)
This library is designed to add a data model over Stanford CoreNLP’s basic XML output.
The Document class is designed to provide lazy-loaded access to information from syntax, coreference, and dependency parse structures within the XML.
Installing the Library¶
It’s as easy as
What You Can Do With This Library¶
Some code examples:
from corenlp_xml import Document
doc = Document(xml_string)
The first sentence
s1 = doc.sentences[0]
Noun phrases for the first sentence
s1_nps = s1.phrase_strings("np")
Text of semantic head of first sentence
s1_head = s1.semantic_head.text
Find all representative coreferences matching noun phrases in sentence 1
s1_corefs = [coref for coref in doc.coreferences if coref.representative and coref.sentence == s1]
Contents: