import java.io.*;
class person{
int s,p1,h;
String data,data1;
int[] point=new int[10000];
String[] person=new String[50000];
int clong,xlong;
String x1,file;
int page,sx;
public static void main(String [] args) {
person test=new person();
}
person(){
sx=0;
for(page=5000;page<6000;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;
for(s=0;s<xlong;s++){
point[s]=0;
}
for(s=0;s<xlong;s++){
clong=x[s].length();
if(clong>1)x1=x[s].substring(clong-1,clong);
if(x1.equals("君"))point[s]=100;
if(x[s].indexOf("請願")>1)point[s]=0;
if(x[s].indexOf("法律案")>1)point[s]=0;
if(x[s].indexOf("法案")>1)point[s]=0;
if(x[s].indexOf("補欠")>1)point[s]=0;
}
for(s=1;s<xlong;s++){
if(point[s]>50)sx=sx+1;
if(point[s]>50)person[sx]=x[s];
}
}
writefile();
}
void writefile(){
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter("person.txt")));
for(s=1;s<sx+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月27日 20:34