2015-11-21 5 views
6
द्वारा दिए गए खुले सूचना निष्कर्षण चल त्रुटि

मैं openIE स्टैनफोर्ड द्वारा दिए गए NLP आदेश आधिकारिक वेबसाइट में दिए गए का उपयोग कर चलाने के लिए कोशिश कर रहा हूँस्टैनफोर्ड

package edu.stanford.nlp.naturalli; 

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.util.CoreMap; 

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

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,depparse,natlog,openie"); 
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()); 
    } 

    // Alternately, to only run e.g., the clause splitter: 
    List<SentenceFragment> clauses = new OpenIE(props).clausesInSentence(sentence); 
    for (SentenceFragment clause : clauses) { 
    System.out.println(clause.parseTree); 
    } 
} 
} 
} 
:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory 
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<clinit>(StanfordCoreNLP.java:99) 
at edu.stanford.nlp.naturalli.OpenIE.main(OpenIE.java:679) 
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory 
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
... 2 more 

फिर जब मैं दिया जावा कोड चलानेमुझे अगली त्रुटि मिलती है:

Adding annotator tokenize 
TokenizerAnnotator: No tokenizer type provided. Defaulting to PTBTokenizer. 
Adding annotator ssplit 
Adding annotator pos 
Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0,7 sec]. 
Adding annotator depparse 
Loading depparse model file: edu/stanford/nlp/models/parser/nndep/english_UD.gz ... 
PreComputed 100000, Elapsed Time: 1.159 (s) 
Initializing dependency parser done [3,5 sec]. 
Adding annotator natlog 
Exception in thread "main" java.lang.IllegalArgumentException: annotator "natlog" requires annotator "parse" 
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:297) 
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:126) 
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:122) 
at stnfrd.OpenIEDemo.main(OpenIEDemo.java:33) 
/home/ue/.cache/netbeans/8.1/executor-snippets/run.xml:53: Java returned: 1 
BUILD FAILED (total time: 4 seconds) 

किसी भी मदद की सराहना की जाएगी। https://github.com/stanfordnlp/CoreNLP या आप उस विशिष्ट जार यहां पा सकते हैं: दूसरा त्रुटि http://www.slf4j.org/download.html

  • +0

    ठीक है, पहले त्रुटि, आप slf4j पुस्तकालय याद कर रहे हैं। क्या आप केवल उन टुकड़ों की बजाय पूरी त्रुटि पोस्ट कर सकते हैं? –

    +0

    आपकी मदद के लिए धन्यवाद :) –

    +0

    मैं पूरा कोड –

    उत्तर

    7
    1. पहले त्रुटि आप slf4j जार, जो वर्तमान में GitHub पर नवीनतम संस्करण में शामिल किया गया है नहीं है "पार्स" की आवश्यकता "नाट्लॉग" के कारण होता है। बदलें "depparse" "पार्स" करने के लिए:

      props.setProperty("annotators", "tokenize,ssplit,pos,parse,natlog,openie"); 
      
    +0

    उन लोगों के लिए जो फ़ाइलें डाउनलोड करते हैं slf4j.org वेबसाइट, आपको बस slf4j-simple- [version] .jar और slf4j-api- [version] .jar की आवश्यकता है – rj2700

    संबंधित मुद्दे