🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

problem with StopwordFilterFile

User: "emolano"
New Altair Community Member
Updated by Jocelyn
Hello, I'm using the API to do some text mining. My code works but when I add these two line it fails:
wvtoolOperator.addOperator(OperatorService
.createOperator("StopwordFilterFile"));
wvtoolOperator.setParameter("file","C:/Documents and Settings/emolano/My Documents/stop_filer_file.txt");

I get this error:
P May 25, 2009 1:43:53 PM: Initialising process setup
P May 25, 2009 1:43:53 PM: [NOTE] No filename given for result file, using stdout for logging results!
P May 25, 2009 1:43:53 PM: Checking properties...
G May 25, 2009 1:43:53 PM: [Error] Parameter 'file' is not set and has no default value.
P May 25, 2009 1:43:53 PM: [Error] StopwordFilterFile: StopwordFilterFile: StopwordFilterFile: file is not defined!
P May 25, 2009 1:43:53 PM: [Error] Properties are not ok
P May 25, 2009 1:43:53 PM: Checking process setup...
P May 25, 2009 1:43:53 PM: Inner operators are ok.
P May 25, 2009 1:43:53 PM: [Error] There was 1 error.
P May 25, 2009 1:43:54 PM: Process initialised
P May 25, 2009 1:43:54 PM: [NOTE] Process starts
P May 25, 2009 1:43:54 PM: Process:
  Root[0] (Process)
  +- DatabaseExampleSource[0] (DatabaseExampleSource)
  +- StringTextInput[0] (StringTextInput)
  |  +- StringTokenizer[0] (StringTokenizer)
  |  +- EnglishStopwordFilter[0] (EnglishStopwordFilter)
  |  +- TokenLengthFilter[0] (TokenLengthFilter)
  |  +- ToLowerCaseConverter[0] (ToLowerCaseConverter)
  |  +- PorterStemmer[0] (PorterStemmer)
  |  +- StopwordFilterFile[0] (StopwordFilterFile)
  |  +- TermNGramGenerator[0] (TermNGramGenerator)
  +- ModelLoader[0] (ModelLoader)
  +- ModelApplier[0] (ModelApplier)
  +- BinominalClassificationPerformance[0] (BinominalClassificationPerformance)
Exception in thread "main" java.lang.NullPointerException
at com.rapidminer.operator.wordfilter.StopwordFilterFile.process(Unknown Source)
at com.rapidminer.operator.AbstractTokenProcessor.apply(Unknown Source)
at com.rapidminer.operator.wordfilter.StopwordFilterFile.apply(Unknown Source)
at com.rapidminer.operator.Operator.apply(Operator.java:666)
at com.rapidminer.operator.TextInput.getTokenSequence(Unknown Source)
at com.rapidminer.operator.TextInput.apply(Unknown Source)
at com.rapidminer.operator.Operator.apply(Operator.java:666)

The weird thing is that I define the file parameter so I don't get why I get this:
G May 25, 2009 1:43:53 PM: [Error] Parameter 'file' is not set and has no default value.
P May 25, 2009 1:43:53 PM: [Error] StopwordFilterFile: StopwordFilterFile: StopwordFilterFile: file is not defined!

could it be a bug?

Thanks
e

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "land"
    New Altair Community Member
    Hi,
    as far as I can see from your code, you are setting the parameter in the wvToolOperator. But this is the operatorChain to which you are adding the stopwordFilterFile operator. So don't set the parameter there but in the created operator itself!

    Greetings,
      Sebastian
    User: "emolano"
    New Altair Community Member
    OP
    Thanks a lot. It works now :)
    key issues:Operators w/o parameters can be added directly but StopwordFilterFile needs to be defined as operator.
    here the code:
    wvtoolOperator.addOperator(OperatorService
    .createOperator("StringTokenizer"));
          wvtoolOperator.addOperator(OperatorService
    .createOperator("EnglishStopwordFilter"));
          wvtoolOperator.addOperator(OperatorService
    .createOperator("TokenLengthFilter"));
          wvtoolOperator.setParameter("min_chars","2");
          wvtoolOperator.addOperator(OperatorService
    .createOperator("ToLowerCaseConverter"));
          wvtoolOperator.addOperator(OperatorService
    .createOperator("PorterStemmer"));
         
          Operator stopwordFilterFile;
          stopwordFilterFile = OperatorService.createOperator("StopwordFilterFile");
          stopwordFilterFile.setParameter("file","C:/Documents and Settings/emolano/My Documents/rm_workspace/mining/platform/stop_filter_platform.txt");
          wvtoolOperator.addOperator(stopwordFilterFile);