-4

I,m working in eclipse with java language but i have error when write the POS standford api code for tagging the text. plz, can any one help me , the error as follow

"Exception in thread "main" java.lang.NoClassDefFoundError: 
 org/slf4j/LoggerFactory at edu.stanford.nlp.pipeline.StanfordCoreNLP. 
(StanfordCore.<clinit>(StanfordCoreNLP.java:99)
at tweetfileanalysis.TweetPOS.tweettag(TweetPOS.java:23)
at tweetfileanalysis.ReadJson.readJsonf(ReadJson.java:288)
at tweetfileanalysis.Mainclass.main(Mainclass.java:17)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown 
Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more

i put all libraries by using configure build path so what can i do to solve the error the class code as follow:

package tweetfileanalysis;

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;


public class TweetPOS{

public TweetPOS() 
{}
 public static void tweettag(String tweet) 
 {
 // Create the Stanford CoreNLP pipeline
    Properties props = new Properties();
    props.getProperty("annotators", 
 "tokenize,ssplit,pos,lemma,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);
  System.out.println("fhfbg");
    // 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
    System.out.println("uuuuuuuuuuuuuuuuuuu");
      for (RelationTriple triple : triples) {
        System.out.println(triple.confidence + "\t" +
            triple.subjectLemmaGloss() + "\t" +
            triple.relationLemmaGloss() + "\t" +
            triple.objectLemmaGloss());
      }
    } 
    }

}

Gernot
  • 1,094
  • 4
  • 25
  • 39

1 Answers1

0

Download slf4j.jar here and config your build path.

Bejond
  • 1,188
  • 1
  • 11
  • 18