アットウィキロゴ

あべ

import java.io.*;

class person{

int s,sx,p1,h;
String data,data1;
int[] point=new int[10000];
String[] person=new String[100000];
String[] cr1=new String[1000];
String[] cr2=new String[1000];

String file;
int page;
int xlong,slong;
String x1,x2;
int cnumber,pnumber;

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

person(){

pnumber=0;
for (page=2000;page<4000;page++){

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

System.out.println(file);

readfile(file);

p1=data.indexOf("○");

if(p1>0)data1=data.substring(0,p1);

String[] x=data1.split("<BR>");

xlong=x.length;


sx=0;
for(s=1;s<xlong;s++){
h=0;
x1="";
slong=x[s].length();
if(slong>1)x1=x[s].substring(slong-1,slong);
if(x1.equals("君"))h=100;
if(h>50)sx=sx+1;
if(h>50)cr1[sx]=x[s];
}
cnumber=sx;

sx=0;
for(s=1;s<cnumber+1;s++){
h=0;
if(cr1[s].indexOf("請願")>1)h=100;
if(cr1[s].indexOf("法律案")>1)h=100;
if(cr1[s].indexOf("法案")>1)h=100;
if(cr1[s].indexOf("補欠")>1)h=100;
if(cr1[s].indexOf("及び")>1)h=100;
if(h<50)sx=sx+1;
if(h<50)cr2[sx]=cr1[s];
}

cnumber=sx;

sx=pnumber;
for(s=1;s<cnumber+1;s++){
sx=sx+1;
person[sx]=cr2[s];
}
pnumber=sx;


}

}

void writefile(){

try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter("person.txt")));

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

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

}



void readfile(String file){

String str;
BufferedReader br;  

data="";

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

}


}
最終更新:2011年06月28日 12:30