2017-11-04 10 views
0

サイトでは、しかし、それを使用する方法を、私はそれを私がstanford-nlpプログラムでフラグオプションを与える方法は?

props.setProperty("openieformat","ollie"); 
props.setProperty("openieresolve_coref","1"); 

しかし、その動作していないが追加されている

import edu.stanford.nlp.ie.util.RelationTriple; 
import edu.stanford.nlp.ling.CoreAnnotations; 
import edu.stanford.nlp.pipeline.Annotation; 
import edu.stanford.nlp.pipeline.StanfordCoreNLP; 
import edu.stanford.nlp.naturalli.NaturalLogicAnnotations; 
import edu.stanford.nlp.util.CoreMap; 

import java.util.Collection; 
import java.util.Properties; 

/** 
* A demo illustrating how to call the OpenIE system programmatically. 
*/ 
public class OpenIEDemo { 

public static void main(String[] args) throws Exception { 
// Create the Stanford CoreNLP pipeline 
Properties props = new Properties(); 
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,depparse,natlog,openie"); 
props.setProperty("openieformat","ollie"); 
props.setProperty("openieresolve_coref","1"); 
StanfordCoreNLP pipeline = new StanfordCoreNLP(props); 

// Annotate an example document. 
Annotation doc = new Annotation("Obama was born in Hawaii. He is our president."); 
pipeline.annotate(doc); 

// Loop over sentences in the document 
for (CoreMap sentence : doc.get(CoreAnnotations.SentencesAnnotation.class)) { 
    // Get the OpenIE triples for the sentence 
    Collection<RelationTriple> triples = sentence.get(NaturalLogicAnnotations.RelationTriplesAnnotation.class); 
    // Print the triples 
    for (RelationTriple triple : triples) { 
    System.out.println(triple.confidence + "\t" + 
     triple.subjectLemmaGloss() + "\t" + 
     triple.relationLemmaGloss() + "\t" + 
     triple.objectLemmaGloss()); 
    } 
} 
} 
} 

この方法をやってみました、私はいくつかのフラグhttps://nlp.stanford.edu/software/openie.html

を使用することができますことを示唆しています

答えて

0

スタンフォードコアNLPの場合、個々のアノテータのフラグ/プロパティにはannotator.flag名前。ブーリアンフラグは "false"または "true"の値を持ちます。だから、何を持っていることは右に近いですが、する必要があります:私は完全な作業のために、私は別のアノテーターdcorefを追加する必要があります考えて、その後発見さ

props.setProperty("openie.format","ollie"); props.setProperty("openie.resolve_coref","true");

+0

一つのこと – Shashwattrivedi

関連する問題