"NoSuchMethodError during using text input plugin"

cnj125cnj125 Member Posts: 2 Contributor I
edited May 2019 in Help
Hi All,

I am following this tutorial to do text classification by rapid and wvtools.
I can build the model and word list successfully, and I try to run the Java problem to classify text by the model. I have changed all the path to my own setting. But it
import java.io.File;
import java.io.IOException;

import com.rapidminer.RapidMiner;
import com.rapidminer.example.Example;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.Model;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorChain;
import com.rapidminer.operator.OperatorCreationException;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.tools.OperatorService;

public class RapidMinerTextClassifier {

private OperatorChain wvtoolOperator;
private Operator modelApplier;
private Model model;

public RapidMinerTextClassifier(File modelFile, File wordListFile)
throws IOException, OperatorCreationException, OperatorException {

RapidMiner.init(false, false, false, true);

// Create the text input operator and set the path to the word list you stored using Rapid Miner
// As there is only a single text, we use the SingleTextInput operator
wvtoolOperator = (OperatorChain) OperatorService
wvtoolOperator.setParameter("input_word_list", wordListFile

// Add additional processing steps.
// Note the setup must be same as the one you used when creating the classification model

// Create the model applier
modelApplier = OperatorService.createOperator("ModelApplier");

// Load the model into a field of the class
Operator modelLoader = OperatorService.createOperator("ModelLoader");
modelLoader.setParameter("model_file", modelFile.getAbsolutePath());
IOContainer container = modelLoader.apply(new IOContainer());
model = container.get(Model.class);


public String apply(String text) throws OperatorException {

// Set the text
wvtoolOperator.setParameter("text", text);

// Call the text input operator
IOContainer container = wvtoolOperator.apply(new IOContainer(model));

// Call the model applier (the model was added already before calling the text input)
container = modelApplier.apply(container);

// Obtain the example set from the io container. It contains only a single example with our text in it.
ExampleSet eset = container.get(ExampleSet.class);
Example e = eset.iterator().next();

// Compare the predicted label with the positive label
return eset.getAttributes().getPredictedLabel().getMapping().mapIndex((int) e.getPredictedLabel());


public static void main(String args[]) throws Exception {
System.setProperty("rapidminer.home", "C:/Program Files/Rapid-I/RapidMiner-4.2");

// Create a text classifier 
RapidMinerTextClassifier tr = new RapidMinerTextClassifier(
new File(
"C:/Documents and Settings/user/My Documents/rm_workspace/sample/data/training_model.mod"),
new File(
"C:/Documents and Settings/user/My Documents/rm_workspace/sample/data/training_words.list"));

// Call the classifier with texts
System.out.println("Test1:" + tr.apply("povrai xflick resolution gif"));
System.out.println("Test2:" + tr.apply("workstation intel switch"));


But it return an error like that
Exception in thread "main" java.lang.NoSuchMethodError: edu.udo.cs.wvtool.main.WVTool.createVector(Ledu/udo/cs/wvtool/main/WVTTokenSequence;Ledu/udo/cs/wvtool/generic/vectorcreation/WVTVectorCreator;Ledu/udo/cs/wvtool/wordlist/WVTWordList;)Ledu/udo/cs/wvtool/main/WVTWordVector;
at com.rapidminer.operator.TextInput.apply(Unknown Source)
at com.rapidminer.operator.Operator.apply(Operator.java:664)
at com.RapidMiner.demo.RapidMinerTextClassifier.apply(RapidMinerTextClassifier.java:64)
at com.RapidMiner.demo.RapidMinerTextClassifier.main(RapidMinerTextClassifier.java:89)
Anyone idea to solve this problem ? Thank you very much


  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder

    are you sure you used the same version of RapidMiner / the Text plugin for model creation and model application?

  • cnj125cnj125 Member Posts: 2 Contributor I
    mierswa wrote:


    are you sure you used the same version of RapidMiner / the Text plugin for model creation and model application?


    I have found out the reason. I have included the wvtool jar file in my problem, and the version may be not correct.
    I can run it after removing it in my classpath. Thank you very much.

Sign In or Register to comment.