public class OpenIE extends Object implements Annotator
An OpenIE system based on valid Natural Logic deletions of a sentence. The system is described in:
"Leveraging Linguistic Structure For Open Domain Information Extraction." Gabor Angeli, Melvin Johnson Premkumar, Christopher Manning. ACL 2015.
The paper can be found at http://nlp.stanford.edu/pubs/2015angeli-openie.pdf.
Documentation on the system can be found on the project homepage, or the CoreNLP annotator documentation page. The simplest invocation of the system would be something like:
java -mx1g -cp stanford-openie.jar:stanford-openie-models.jar edu.stanford.nlp.naturalli.OpenIE
Note that this class serves both as an entry point for the OpenIE system, but also as a CoreNLP annotator which can be plugged into the CoreNLP pipeline (or any other annotation pipeline).
annotate(Annotation),
main(String[])Annotator.Requirement| Modifier and Type | Field and Description |
|---|---|
Optional<ClauseSplitter> |
clauseSplitter
The clause splitter model, if one is to be used.
|
ForwardEntailer |
forwardEntailer
The forward entailer model, running a search from clauses to maximally shortened clauses.
|
RelationTripleSegmenter |
segmenter
The relation triple segmenter, which converts a maximally shortened clause into an OpenIE
extraction triple.
|
BINARIZED_TREES_REQUIREMENT, CLEAN_XML_REQUIREMENT, COLUMN_DATA_CLASSIFIER, COREF_REQUIREMENT, DEPENDENCY_REQUIREMENT, DETERMINISTIC_COREF_REQUIREMENT, ENTITY_MENTIONS_REQUIREMENT, GENDER_REQUIREMENT, GUTIME_REQUIREMENT, HEIDELTIME_REQUIREMENT, LEMMA_REQUIREMENT, MENTION_REQUIREMENT, NATLOG_REQUIREMENT, NER_REQUIREMENT, NUMBER_REQUIREMENT, OPENIE_REQUIREMENT, PARSE_AND_TAG, PARSE_REQUIREMENT, PARSE_TAG_BINARIZED_TREES, PARSE_TAG_DEPPARSE, PARSE_TAG_DEPPARSE_BINARIZED_TREES, POS_REQUIREMENT, QUANTIFIABLE_ENTITY_NORMALIZATION_REQUIREMENT, QUOTE_REQUIREMENT, RELATION_EXTRACTOR_REQUIREMENT, REQUIREMENTS, SSPLIT_REQUIREMENT, STANFORD_CLEAN_XML, STANFORD_COLUMN_DATA_CLASSIFIER, STANFORD_COREF, STANFORD_DEPENDENCIES, STANFORD_DETERMINISTIC_COREF, STANFORD_ENTITY_MENTIONS, STANFORD_GENDER, STANFORD_LEMMA, STANFORD_MENTION, STANFORD_NATLOG, STANFORD_NER, STANFORD_OPENIE, STANFORD_PARSE, STANFORD_POS, STANFORD_QUOTE, STANFORD_REGEXNER, STANFORD_RELATION, STANFORD_SENTIMENT, STANFORD_SSPLIT, STANFORD_TOKENIZE, STANFORD_TRUECASE, STANFORD_UD_FEATURES, STEM_REQUIREMENT, SUTIME_REQUIREMENT, TIME_WORDS_REQUIREMENT, TOKENIZE_AND_SSPLIT, TOKENIZE_REQUIREMENT, TOKENIZE_SSPLIT_NER, TOKENIZE_SSPLIT_PARSE, TOKENIZE_SSPLIT_PARSE_NER, TOKENIZE_SSPLIT_POS, TOKENIZE_SSPLIT_POS_DEPPARSE, TOKENIZE_SSPLIT_POS_LEMMA, TRUECASE_REQUIREMENT, UD_FEATURES_REQUIREMENT| Constructor and Description |
|---|
OpenIE()
Create a new OpenIE system, with default properties
|
OpenIE(Properties props)
Create a ne OpenIE system, based on the given properties.
|
| Modifier and Type | Method and Description |
|---|---|
void |
annotate(Annotation annotation)
Given an Annotation, perform a task on this Annotation.
|
void |
annotateSentence(CoreMap sentence,
Map<CoreLabel,List<CoreLabel>> canonicalMentionMap)
Annotate a single sentence.
|
List<SentenceFragment> |
clausesInSentence(CoreMap sentence)
Find the clauses in a sentence.
|
List<SentenceFragment> |
clausesInSentence(SemanticGraph tree,
boolean assumedTruth)
Find the clauses in a sentence, where the sentence is expressed as a dependency tree.
|
List<SentenceFragment> |
entailmentsFromClause(SentenceFragment clause)
Returns all of the entailed shortened clauses (as per natural logic) from the given clause.
|
Set<SentenceFragment> |
entailmentsFromClauses(Collection<SentenceFragment> clauses)
Returns all the maximally shortened entailed fragments (as per natural logic)
from the given collection of clauses.
|
static void |
main(String[] args)
An entry method for annotating standard in with OpenIE extractions.
|
Optional<RelationTriple> |
relationInFragment(SentenceFragment fragment)
Returns the possible relation triple in this sentence fragment.
|
List<RelationTriple> |
relationsInClause(SentenceFragment clause)
Extract the relations in this clause.
|
List<RelationTriple> |
relationsInFragments(Collection<SentenceFragment> fragments)
Returns the possible relation triple in this set of sentence fragments.
|
List<RelationTriple> |
relationsInSentence(CoreMap sentence)
Extract the relations in this sentence.
|
Set<Annotator.Requirement> |
requirementsSatisfied()
Returns a set of requirements for which tasks this annotator can
provide.
|
Set<Annotator.Requirement> |
requires()
Returns the set of tasks which this annotator requires in order
to perform.
|
public final Optional<ClauseSplitter> clauseSplitter
public final ForwardEntailer forwardEntailer
public RelationTripleSegmenter segmenter
public OpenIE()
public OpenIE(Properties props)
props - The properties to parametrize the system with.public List<SentenceFragment> clausesInSentence(SemanticGraph tree, boolean assumedTruth)
tree - The dependency tree representation of the sentence.assumedTruth - The assumed truth of the sentence. This is almost always true, unless you are
doing some more nuanced reasoning.public List<SentenceFragment> clausesInSentence(CoreMap sentence)
sentence - The raw sentence to extract clauses from.clausesInSentence(SemanticGraph, boolean)public List<SentenceFragment> entailmentsFromClause(SentenceFragment clause)
clausesInSentence(CoreMap).clause - The premise clause, as a sentence fragment in itself.public Set<SentenceFragment> entailmentsFromClauses(Collection<SentenceFragment> clauses)
clauses - The clauses to shorten further.public Optional<RelationTriple> relationInFragment(SentenceFragment fragment)
public List<RelationTriple> relationsInFragments(Collection<SentenceFragment> fragments)
public List<RelationTriple> relationsInClause(SentenceFragment clause)
public List<RelationTriple> relationsInSentence(CoreMap sentence)
public void annotateSentence(CoreMap sentence, Map<CoreLabel,List<CoreLabel>> canonicalMentionMap)
Annotate a single sentence.
This annotator will, in particular, set the NaturalLogicAnnotations.EntailedSentencesAnnotation
and NaturalLogicAnnotations.RelationTriplesAnnotation annotations.
public void annotate(Annotation annotation)
This annotator will, in particular, set the NaturalLogicAnnotations.EntailedSentencesAnnotation
and NaturalLogicAnnotations.RelationTriplesAnnotation annotations.
public Set<Annotator.Requirement> requirementsSatisfied()
requirementsSatisfied in interface Annotatorpublic Set<Annotator.Requirement> requires()
public static void main(String[] args) throws IOException, InterruptedException
IOExceptionInterruptedException