Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Community Q&A
Execute script Operator include many .java files
mmarag
Hello,
I have a project in java that is consisted of 4 .java files 1 main.java and 3 others within a package called cs.nlp.module.
In the execute operator I have included the code of main.java but I cannot figure out how to include the other files.
import cs.nlp.module.File1; etc. does not seem to work.
I even try to put the files right in the lib folder of RM but no success.
Any help is highly appreciated
With regards
MM
Find more posts tagged with
AI Studio
Accepted answers
MartinLiebig
you need to compile the java files to a jar first. this can be used then.
Best,
Martin
All comments
MartinLiebig
you need to compile the java files to a jar first. this can be used then.
Best,
Martin
mmarag
thank you, I have compiled everything to a jar. Placed the jar in lib folder of rapidminer.
I have created a draft process to test it but I get a java.lang.ArrayIndexOutOfBoundsException of a function within this jar.
here is the process
<?xml version="1.0" encoding="UTF-8"?><process version="9.2.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<process expanded="true">
<operator activated="true" class="text:create_document" compatibility="8.1.000" expanded="true" height="68" name="Create Document" width="90" x="179" y="136">
<parameter key="text" value="Αυτό είναι ένα μικρό παράδειγμα ανάλυσης κειμένου."/>
<parameter key="add label" value="false"/>
<parameter key="label_type" value="nominal"/>
</operator>
<operator activated="true" class="text:documents_to_data" compatibility="8.1.000" expanded="true" height="82" name="Documents to Data" width="90" x="313" y="289">
<parameter key="text_attribute" value="Input"/>
<parameter key="add_meta_information" value="true"/>
<parameter key="datamanagement" value="double_sparse_array"/>
<parameter key="data_management" value="auto"/>
</operator>
<operator activated="true" class="execute_script" compatibility="9.2.001" expanded="true" height="82" name="Execute Script (2)" origin="GENERATED_TUTORIAL" width="90" x="447" y="187">
<parameter key="script" value="import com.rapidminer.tools.Ontology import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Vector; import java.util.HashMap; import java.util.Iterator; import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; import gr.aueb.cs.nlp.postagger.SmallSetFunctions; import gr.aueb.cs.nlp.postagger.BigSetFunctions; import gr.aueb.cs.nlp.postagger.WordWithCategory; import java.util.List; ExampleSet exampleSet = operator.getInput(ExampleSet.class); Attributes attributes = exampleSet.getAttributes(); Attribute att1 = attributes.get("Input"); Attribute Output = AttributeFactory.createAttribute("Output", Ontology.STRING); attributes.addRegular(Output); exampleSet.getExampleTable().addAttribute(Output); for (Example example : exampleSet) { String tempText = example.getNominalValue(att1); //String manolis=""; 		 //start POS 		 List<WordWithCategory> list = null; 		 list = SmallSetFunctions.smallSetClassifyString("Αυτό είναι ένα μικρό παράδειγμα ανάλυσης κειμένου."); //list = BigSetFunctions.bigSetClassifyString("tempText"); for (int i = 0; i < list.size(); i++) { //manolis=manolis + " " + list.get(i).toString(); System.out.println(list.get(i).toString()); } 		 //end POS example.setValue(Output, tempText.toUpperCase()); } //exampleSetOutput.deliver(exampleSet); return exampleSet;"/>
<parameter key="standard_imports" value="true"/>
</operator>
<connect from_op="Create Document" from_port="output" to_op="Documents to Data" to_port="documents 1"/>
<connect from_op="Documents to Data" from_port="example set" to_op="Execute Script (2)" to_port="input 1"/>
<connect from_op="Execute Script (2)" from_port="output 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="90"/>
</process>
</operator>
</process>
and here:
https://www.dropbox.com/s/r769u6323z1fxa0/TestPOS.zip?dl=0
you can find a Netbeans project I made to test if my jar works that works pretty fine.
Any help would be highly appreciated!
mmarag
Some update. I ran RM from script and from the exe and I get two different types of error messages
regards
mmarag
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups