The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

"rapidminer and java setlistparameter"

platanas20platanas20 Member Posts: 22 Contributor II
edited May 2019 in Help
Hello to everyone,
I want to create in java a project using rapidminer libraries.What i want to do is to add the operator "process documents from files" , but i dont know how to use the method setlistparameter to add my directories.
The code in xml is this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.1.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.1.008" expanded="true" name="Process">
    <parameter key="encoding" value="UTF-8"/>
    <parameter key="parallelize_main_process" value="true"/>
    <process expanded="true" height="510" width="791">
      <operator activated="true" class="text:process_document_from_file" compatibility="5.1.002" expanded="true" height="76" name="Process Documents from Files" width="90" x="112" y="120">
        <list key="text_directories">
          <parameter key="P" value="H:\Epifaneia Ergasias\RapidMiner\Positive"/>
          <parameter key="N" value="H:\Epifaneia Ergasias\RapidMiner\Negative"/>
        </list>
        <parameter key="encoding" value="UTF-8"/>
        <parameter key="parallelize_vector_creation" value="true"/>
        <process expanded="true" height="528" width="809">
          <operator activated="true" class="text:tokenize" compatibility="5.1.002" expanded="true" height="60" name="Tokenize" width="90" x="45" y="30"/>
          <operator activated="true" class="text:stem_porter" compatibility="5.1.002" expanded="true" height="60" name="Stem (Porter)" width="90" x="313" y="30"/>
          <connect from_port="document" to_op="Tokenize" to_port="document"/>
          <connect from_op="Tokenize" from_port="document" to_op="Stem (Porter)" to_port="document"/>
          <connect from_op="Stem (Porter)" from_port="document" to_port="document 1"/>
          <portSpacing port="source_document" spacing="0"/>
          <portSpacing port="sink_document 1" spacing="0"/>
          <portSpacing port="sink_document 2" spacing="0"/>
        </process>
      </operator>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
    </process>
  </operator>
</process>
How can i convert in java this part of xml "<list key="text_directories">
          <parameter key="P" value="H:\Epifaneia Ergasias\RapidMiner\Positive"/>
          <parameter key="N" value="H:\Epifaneia Ergasias\RapidMiner\Negative"/>
          </list>"?


thanks
platanas
Tagged:

Answers

  • colocolo Member Posts: 236 Maven
    Hi platanas,

    unfortunately I don't have the time to test this right now, but perhaps this piece of code, that I used to set list parameters some time ago, will also help you to find the solution. This was used for "Cut Documents", but I guess in your case it should be rather similar (maybe using other types).

    List<String[]> extractionExpressionList = new ArrayList<String[]>();
    String[] extractionExpressions = {"Expression_Results", regex};
    extractionExpressionList.add(extractionExpressions);

    extractionOperator.setParameter("query_type", Integer.toString(QueryService.MODE_REGULAR_EXPRESSION));
    extractionOperator.setListParameter(QueryService.PARAMETER_REGEX_QUERIES, extractionExpressionList);
    Regards
    Matthias
Sign In or Register to comment.