Pregunta

import java.io.IOException;

import edu.stanford.nlp.tagger.maxent.MaxentTagger;

public class TagText {
    public static void main(String[] args) throws IOException, ClassNotFoundException {

        // Initialize the tagger
        MaxentTagger tagger = new MaxentTagger("taggers/models/wsj-0-18-bidirectional distsim.tagger");

        // The sample string
        String sample = "This is a sample text.";

        // The tagged string
        String tagged = tagger.tagString(sample);

        // Output the result
        System.out.println(tagged);
     }
}

This is my code and in the JCreator > Configure >Option > JDK Tools

In the Select Tool Type : Compiler

The Parameter I have set to -g -source 1.5 -classpath "$[ClassPath]" -d "$[OutputPath]" -classpath stanford-postagger.jar $[JavaFiles]

And in the Run Application, the parameter I set to -classpath "$[ClassPath]" -classpath stanford-postagger.jar edu.stanford.nlp.tagger.maxent.MaxentTagger $[JavaClass]

The stanford-postagger file is in location C:\prototype. When I run the program it show me the result:

Exception in thread "main" java.lang.RuntimeException: unknown argument(s): "TagText"
    at edu.stanford.nlp.tagger.maxent.TaggerConfig.<init>(TaggerConfig.java:139)
    at edu.stanford.nlp.tagger.maxent.TaggerConfig.<init>(TaggerConfig.java:133)
    at edu.stanford.nlp.tagger.maxent.MaxentTagger.main(MaxentTagger.java:1603)

Process completed.

What I have done wrong?

¿Fue útil?

Solución

In the Run Application remove the parameter:

edu.stanford.nlp.tagger.maxent.MaxentTagger
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top