アットウィキロゴ

メイン 議事録

import java.io.*;

class pro{

String file;

String word;
String bun,data;
int m,n;
String[] surface=new String[1000];
String[] reading=new String[1000];
String[] pos=new String[1000];
String[][] xsurface=new String[1000][1000];
String[][] xreading=new String[1000][1000];
String[][] xpos=new String[1000][1000];

int[] xnumber=new int[1000];
int wordnumber,linenumber;

public static void main(String [] args) {
        pro test=new pro();
            }

pro(){

file="popo.txt";

readfile(file);

String[] x=data.split("。");


linenumber=x.length;

for(m=0;m<x.length;m++){
word=x[m];

yahoo yh=new yahoo();
yh.makedata(word);
bun=yh.bun;

xml xx=new xml();
xx.makedata(bun);
surface=xx.surface;
wordnumber=xx.wordnumber;

for(n=1;n<wordnumber+1;n++){
xsurface[m][n]=surface[n];
}
xnumber[m]=wordnumber;

}

file="data.txt";
writefile(file);

}


void writefile(String file){
int s;
s=0;

try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(file)));

for(m=0;m<linenumber;m++){
for (n=1;n<xnumber[m]+1;n++){
s=s+1;
pw.print(s);  
pw.print(",");  
pw.println(xsurface[m][n]);    
}
}
System.out.println("ファイルに書きこみました。");

pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }



}



public void readfile(String file){

String s;
BufferedReader br;

data="";

try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));  
while((s = br.readLine()) != null) {  
data=data+s;  
}
br.close();
} catch (IOException e) {System.out.println(e);}


}


}
最終更新:2011年05月07日 16:43