Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
problem with StopwordFilterFile
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
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
Tagged:
0
Answers
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
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);