2017-11-04 5 views
0

이 사이트는 그러나 그것을 사용하는 방법을, 나는 그것을 내가스탠포드 -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

StanfordCoreNLP의 경우 개별 어노 테이터의 플래그/속성은으로 설정됩니다.이름. 부울 플래그는 "false"또는 "true"값을가집니다. 나는 완벽한 작업을 위해, 또 다른 주석 자에 dcoref을 추가해야합니다 생각

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

+0

한 가지 내가 나중에 발견 : 그럼, 당신이 가진 것은 오른쪽에 가깝지만 할 필요가 – Shashwattrivedi