I have developed myself tagger and I want to host on the web. my server is based on jsp. But This tagger is based on svmtool and it has been written in Perl script. That's why, I have created one ".java" file. In this file I've created Processor builder and via the Runtime.getRuntime().exec through this process I am calling this file.
It is working but it doesn't show my output. Plz help to solve this issue. For the better under standing below I am giving my java code and also given last line of output/stop the process:
import java.io.*;
public class ExeCommand {
String outS = "", errS="";
try {
// run the Unix "type your terminal command" command
System.out.println ("Running tagger!");
String command = "perl /home/svmtool_v1.3.2/bin/SVMTagger.pl -V 4 -S LRL /home/svmtool_v1.3.2/models/ih/IN < /home/tomcat4.1.40/webapps/pos/textfile/tests.txt > /home/tomcat4.1.40/webapps/pos/textfile/output.txt";
Process p = Runtime.getRuntime().exec(command);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// read the output from the command
System.out.println("It will take time so keep the patience:\n" + command);
System.out.println ("First error line: " + stdError.readLine());
// read any errors from the attempted command
System.out.println("Please check your command (if any):\n");
while ((errS = stdError.readLine()) != null) {
System.out.println("Error:\t" + errS);
}
stdError.close();
System.out.println ("First output line: " + stdInput.readLine());
while ((outS = stdInput.readLine()) != null) {
System.out.println("Output:\t" + outS);
}
stdInput.close();
System.out.println("Finished!");
}
catch (Exception e) {
System.out.println("found exception: " + e);
e.printStackTrace();
//System.exit(-1);
}
System.out.println("Finished all!");
}
}
After this nothing doing:
TAGGING < DIRECTION = left-to-right then right-to-left >
Aucun commentaire:
Enregistrer un commentaire