package x2;
import tool.catchword;
import tool.readfile;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[50000];
String[] credit=new String[50000];
String[] year=new String[50000];
String[] index=new String[50000];
String[] v=new String[50000];
String[] code=new String[50000];
String[] subdata=new String[500000];
String[] com_p=new String[5000];
String[] credit_p=new String[5000];
String[] index_p=new String[5000];
String[] vs=new String[5000];
public static void main(String[] args) {
pro test=new pro();
}
pro(){
String[] dic_credit=new String[500];
int number_credit=0;
int tr;
int n=0;
for(tr=1;tr<11;tr++){
readfile sub7=new readfile();
sub7.makedata("gdata/"+tr+".txt","UTF-8");
data=sub7.data;
datanumber=sub7.datanumber;
for(s=1;s<datanumber+1;s++){
catchword sub2=new catchword();
credit[s]=sub2.makedata(data[s],"credit");
index[s]=sub2.makedata(data[s],"code");
v[s]=sub2.makedata(data[s],"value");
year[s]=sub2.makedata(data[s],"city");
}
int sx;
for(s=1;s<datanumber+1;s++){
int h=0;
for(sx=1;sx<number_credit+1;sx++){
if(credit[s].equals(dic_credit[sx]))h=100;
}
if(h<50)number_credit=number_credit+1;
if(h<50)dic_credit[number_credit]=credit[s];
}
for(s=1;s<datanumber+1;s++){
for(sx=1;sx<number_credit+1;sx++){
if(credit[s].equals(dic_credit[sx]))code[s]="c"+sx;
}
}
for(s=1;s<datanumber+1;s++){
n=n+1;
subdata[n]=year[s]+","+index[s]+","+credit[s]+","+code[s]+","+v[s];
}
}
System.out.println(n);
for(s=1;s<number_credit+1;s++){
System.out.println("c"+s+","+dic_credit[s]);
}
datanumber=n;
writexml("ren.csv");
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber+1;s++){
pw.println(subdata[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2017年02月23日 22:41