import java.io.*;
public class authordic{
String[] data=new String[50000];
String[] dic=new String[5000];
String[][] author=new String[250][500];
int[] number=new int[250];
int s,sx,datanumber,dicnumber;
String file;
String str,str1,str2;
int page,p1,p2,h;
public static void main(String[] args){
authordic test=new authordic();
}
authordic(){
for(page=1;page<220;page++){
file="author/";
file=file+page;
file=file+".txt";
readfile(file);
for(s=1;s<datanumber+1;s++){
author[page][s]=data[s];
}
number[page]=datanumber;
}
dicnumber=0;
for(page=1;page<220;page++){
for(s=1;s<number[page]+1;s++){
h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(author[page][s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=author[page][s];
}
}
writefile();
}
void writefile(){
int s,sx;
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter("author.txt")));
for(s=1;s<dicnumber+1;s++){
pw.println(dic[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月13日 09:04