アットウィキロゴ

個人名特定

import java.io.*;

class person{

String data,file,datax;
String title;
int s,page,p1,p2;
int h;
int com;
String[] z=new String[1000];
int zlong;

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

person(){

for(page=4000;page<5000;page++){

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

readfile(file);

p1=data.indexOf("<TITLE>");
p2=data.indexOf("</TITLE>");

title=data.substring(p1+7,p2);



com=100;
if(title.indexOf("本会議")>-1)com=0;

zlong=0;

if(com>50)per(data);

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

writefile(file);

}

}

void writefile(String file){

try{

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

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

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

}

void per(String data){

String datax,x1;
String[] y=new String[1000];
int p1,s,sx,xlong,ylong,h;

p1=data.indexOf("<B>○");
datax=data.substring(0,p1);

String[] x=datax.split("<BR>");
sx=0;
for(s=1;s<x.length;s++){
xlong=x[s].length();
x1="△";
if(xlong>10)x1=x[s].substring(xlong-1,xlong);
if(x1.equals("君"))sx=sx+1;
if(x1.equals("君"))y[sx]=x[s];
}

ylong=sx;

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

}

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月29日 13:13