générer la sortie d'une commande dos dans un fichier texte
Bonjour,
j'ai utilisé l'étiqueteur tree tagger sur des textes.
voilà le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
package cvanalysis;
import java.io.*;
public class TreeTagger {
public TreeTagger(File file) throws IOException {
final FileInputStream input = new FileInputStream(file);
String fileAbsolutePath = file.getAbsolutePath();
String name=file.getName();
TreeTagger treeTaggerObj=new TreeTagger(null);
treeTaggerObj.analyser_morph(file);
treeTaggerObj.PrintInFile(name);
}
public void analyser_morph(File f){
// File f=null;
//final FileInputStream input = new FileInputStream(f);
String path= f.getAbsolutePath();
String name="sortie.txt";
String ch="C:\\WINDOWS\\System32\\cmd.exe";
String ch1= "C:\\treetagger";
String ch2="tokenise-fr.pl"+path+"| bin\tree-tagger.exe lib\french.par -lemma -token -sgml >"+name ;
try{
Process p= Runtime.getRuntime().exec(new String[]{"cmd", "/c",ch});
Process p1= Runtime.getRuntime().exec(new String[]{"cmd", "/c", ch1});
Process p2=Runtime.getRuntime().exec(new String[]{"cmd", "/c", ch2});
wait(5);
}
catch(Exception e){System.out.println(e);}
}
} |
Maintenant je veux récupérer la sortie de la commande dans un fichier texte.
Si quelqu'un de vous a une idée n'hésitez pas de me passer :cry:
Je vous attends.
Merci d'avance