import java.io.*;
class author{
String urlx,bun,file,str;
String[] data=new String[5000];
String[] credit=new String[5000];
String[] word=new String[5000];
int s,datanumber,creditnumber,wordnumber;
int h,j,k,sx,p1,s1,s2,ch;
int page,n;
int[] count=new int[200];
public static void main(String [] args) {
author test=new author();
}
author(){
readfile("count.txt");
for(s=1;s<177;s++){
count[s]=Integer.parseInt(data[s]);
}
for(page=1;page<177;page++){
for(n=1;n<count[page]+1;n++){
file="data/";
file=file+page;
file=file+"/";
file=file+n;
file=file+".txt";
readfile(file);
sx=0;
ch=0;
for(s=1;s<datanumber+1;s++){
h=0;
if(data[s].indexOf("君<BR>")>-1)h=h+1;
if(ch<50)h=h+1;
if(h==2)sx=s;
if(h==2)ch=100;
}
s1=sx;
sx=0;
ch=0;
for(s=1;s<datanumber+1;s++){
h=0;
if(data[s].indexOf("<B>○")>-1)h=h+1;
if(ch<50)h=h+1;
if(h==2)sx=s;
if(h==2)ch=100;
}
s2=sx;
bun=data[s1];
for(s=s1+1;s<s2;s++){
bun=bun+data[s];
}
if(bun==null)bun="規格外";
String[] x=bun.split("君<BR>");
for(s=0;s<x.length;s++){
x[s]=x[s].replace(" ","△");
}
sx=0;
for(s=0;s<x.length;s++){
p1=x[s].indexOf("君△");
String[] y=x[s].split("君△");
if(p1>1)sx=sx+1;
if(p1>1)credit[sx]=y[0];
if(p1>1)sx=sx+1;
if(p1>1)credit[sx]=y[1];
if(p1<0)sx=sx+1;
if(p1<0)credit[sx]=x[s];
}
creditnumber=sx;
sx=0;
for(s=1;s<creditnumber+1;s++){
credit[s]=credit[s].replace("理事","△");
credit[s]=credit[s].replace("△委員長","△");
credit[s]=credit[s].replace("△代理","△");
credit[s]=credit[s].replace("<BR>","△");
credit[s]=credit[s].replace("出席国務大臣","△");
credit[s]=credit[s].replace("出席政府委員","△");
credit[s]=credit[s].replace("委員外の出席者","△");
credit[s]=credit[s].replace("参考人","△");
credit[s]=credit[s].replace("特別補佐人","△");
credit[s]=credit[s].replace("…","△");
credit[s]=credit[s].replace("△","");
h=0;
str="規格外です";
if(credit[s].length()>5)str=credit[s].substring(0,2);
if(str.equals("政府"))credit[s]=credit[s].replace("政府","");
h=0;
if(credit[s].length()<50)h=h+1;
j=0;
if(credit[s].indexOf("委員の異動")<0)j=j+1;
if(credit[s].indexOf("本日の会議")<0)j=j+1;
if(credit[s].indexOf("当選")<0)j=j+1;
if(credit[s].indexOf("出席委員")<0)j=j+1;
if(credit[s].indexOf("辞任")<0)j=j+1;
if(credit[s].indexOf("紹介")<0)j=j+1;
if(credit[s].indexOf("?")<0)j=j+1;
if(credit[s].indexOf("分科")<0)j=j+1;
if(j==8)h=h+1;
k=0;
if(credit[s].indexOf("月")<0)k=k+1;
if(credit[s].indexOf("日")<0)k=k+1;
if(k==2)h=h+1;
if(h==3)sx=sx+1;
if(h==3)word[sx]=credit[s];
}
wordnumber=sx;
file="author/";
file=file+page;
file=file+"/";
file=file+n;
file=file+".txt";
if(wordnumber>2)writefile(file);
if(wordnumber<2)kfile(file);
}
}
}
void kfile(String file){
int sx;
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(file)));
pw.println("規格外です");
System.out.println("ファイルに書きこみました。");
pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
void writefile(String file){
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(file)));
for(s=1;s<wordnumber+1;s++){
pw.println(word[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月02日 21:02