アットウィキロゴ

発言者特定

import java.io.*;

class person{

String data;
int[] x=new int[1000];
int[] y=new int[1000];
String[] credit=new String[1000];
String[] dic=new String[1000];
int s,sx,xmlnumber,dicnumber;
int h,p1,p2;
String str1,str2;

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

person(){

readfile("data/5000.txt");

xymaker(data);

for(s=1;s<xmlnumber+1;s++){
credit[s]=creditmaker(s,data);
}

for(s=1;s<xmlnumber+1;s++){
credit[s]=credit[s].replace("委員長代理","");
credit[s]=credit[s].replace("委員長","");
credit[s]=credit[s].replace("委員","");
credit[s]=credit[s].replace("証人","");
}

dicnumber=0;

for(s=1;s<xmlnumber+1;s++){
h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(credit[s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=credit[s];
}

str1="(";
str2="(";

for(s=1;s<dicnumber+1;s++){
p1=dic[s].indexOf(str1);
if(p1>1)dic[s]=dic[s].substring(0,p1);
System.out.println(dic[s]);
}

p1=data.indexOf(dic[2]);
p2=data.indexOf("君",p1);

System.out.println(data.substring(p1,p2));

p1=data.indexOf(dic[3]);
p2=data.indexOf("君",p1);

System.out.println(data.substring(p1,p2));


p1=data.indexOf(dic[4]);
p2=data.indexOf("君",p1);

System.out.println(data.substring(p1,p2));



}

String creditmaker(int s,String data){
int p1,p2;
String cr;
p1=x[s];
p2=y[s];
cr=data.substring(p1+4,p2);
return cr;
}

void xymaker(String data){
int s,p1;
s=1;
p1=data.indexOf("<B>");
x[s]=p1;
while(p1>1){
p1=data.indexOf("<B>",p1+1);
if(p1>1)s=s+1;
if(p1>1)x[s]=p1;
}
xmlnumber=s;
for(s=1;s<xmlnumber+1;s++){
y[s]=data.indexOf("</B>",x[s]);
}

}

void readfile(String file){

String str;
BufferedReader br;  

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日 10:59