アットウィキロゴ

renbd

import java.io.*;

class den{

int[] com=new int[20];
String[] data=new String[50000];
String[] author=new String[50000];
String[] dic=new String[5000];
int s,sx,datanumber,articlenumber;
String file,str1,str2,str3,str4,str5,str6,str7,str8,str9;
int page,p1,p2;
int h,spoint;
int m,n,authornumber,dicnumber;

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

den(){        


makecom();


sx=0;
for(m=13;m<20;m++){
for(n=1;n<com[m]+1;n++){

page=m*100+n;

file="data/";
file=file+page;
file=file+".txt";

readfile(file);

str1="(";
str2="退席)";
str3="退場)";
str4="声あり)";
str5=")";
str6="(整理回収機構)";
str7="(13";
str8="退室)";
str9="入室)";

spoint=0;
for(s=1;s<datanumber+1;s++){
h=0;
p1=data[s].indexOf(str1);
if(p1==0)h=h+1;
p1=data[s].indexOf("本文");
if(p1>0)h=h+1;
if(h==2)spoint=s;
}

System.out.println(spoint);



for(s=spoint+1;s<datanumber+1;s++){
h=0;
p1=data[s].indexOf(str1);
if(p1==0)h=h+1;
p1=data[s].indexOf("報道関係者");
if(p1<0)h=h+1;
p1=data[s].indexOf("異議なし");
if(p1<0)h=h+1;
p1=data[s].indexOf("提出資料");
if(p1<0)h=h+1;
p1=data[s].indexOf("答申文");
if(p1<0)h=h+1;
p1=data[s].indexOf(str2);
if(p1<0)h=h+1;
p1=data[s].indexOf(str3);
if(p1<0)h=h+1;
p1=data[s].indexOf(str4);
if(p1<0)h=h+1;
p1=data[s].indexOf(str6);
if(p1<0)h=h+1;
p1=data[s].indexOf(str7);
if(p1<0)h=h+1;
p1=data[s].indexOf(str9);
if(p1<0)h=h+1;
p1=data[s].indexOf(str8);
if(p1<0)h=h+1;
p1=data[s].indexOf(str1);
p2=data[s].indexOf(str5);
if(p1+3<p2)h=h+1;
if(h==13)sx=sx+1;
if(h==13)author[sx]=data[s];
}


}
}

authornumber=sx;

dicnumber=0;
for(s=1;s<authornumber+1;s++){
String[] x=author[s].split(str5);
h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(x[0].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=x[0];
}



writefile("c.txt");



}

void makecom(){

com[13]=35;
com[14]=42;
com[15]=30;
com[16]=35;
com[17]=31;
com[18]=31;
com[19]=15;

}


void writefile(String file){

int s,sx;

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


for(s=1;s<dicnumber+1;s++){                                                
pw.println(dic[s]);                                                              
}  

System.out.println("ファイルに書きこみました。");
pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }

}




void readfile(String file){

String str;
BufferedReader br;  

s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));  
while((str = br.readLine()) != null) {  
s=s+1;
data[s]=str;  
}
br.close();
} catch (IOException e) {System.out.println(e);}  

datanumber=s;

}





}
最終更新:2011年07月08日 00:32