Options

Reading documents Integration with java

abdelrahmanMageabdelrahmanMage Member Posts: 1 Contributor I
edited November 2018 in Help
Hey All,

I am currently working on my graduation project and i have a process in rapid in which i want to input multiple text documents to rapid miner one at a time. The process in rapidminer is working very well however when i try to call it from the java application it keeps getting me errors. Below is the java code. I know that i have a problem to input the file to the code so please any help will be appreciated. Here is my code. I input any parameter as i do not know the right parameter to be input

import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.operator.*;
import com.rapidminer.operator.AbstractIOObject.InputStreamProvider;
import com.rapidminer.operator.text.io.filereader.PDFFileReader;
import com.rapidminer.parameter.Parameters;
import com.rapidminer.tools.XMLException;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class ReadRapidminerProcess {


private static final Parameters PDFFileReader =  new Parameters();
public static void main(String[] args) throws OperatorException, IOException, XMLException {

      RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
      RapidMiner.init();

      Process process = new Process(new File("/Users/abdelrahmanayad/Desktop/reading.rmp"));
      Operator op = process.getOperator("Read CV");
      op.setParameters(PDFFileReader);
     
      process.run();
    }
}

Tagged:

Answers

  • Options
    Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,995 RM Engineering
    Hi,

    1) What errors? I can only guess by looking at your code right now.
    2) What process? I'd like the xml of the process to have a look at it.
    3) Is the operator really called "Read CV"?
    4) You set parameters one at a time. You look up the static variable which is the key for said parameter and then set it, e.g.

    operator.setParameter("parameter_key", "parameter_value");
    Regards,
    Marco
Sign In or Register to comment.