import java.io.*;
class dic{
int datanumber,authornumber,dicnumber;
String[] data=new String[50000];
String[] word=new String[50000];
String[] dic=new String[50000];
int wordnumber;
String str,file;
int strlong,s,sx;
int t,h,n,n1,year,no;
int articlenumber;
public static void main(String args[]){
dic test=new dic();
}
dic(){
dicnumber=0;
for(year=13;year<20;year++){
n1=makenum(year);
for(n=1;n<n1+1;n++){
no=100*year+n;
file="gdata/";
file=file+no;
file=file+".txt";
System.out.println(file);
readfile(file);
sx=0;
for(s=1;s<datanumber+1;s++){
str=data[s];
String[] x=str.split(" ");
strlong=x.length;
h=0;
if(strlong>2)h=h+1;
if(x[0].equals("@"))h=0;
if(h==1)sx=sx+1;
if(h==1)word[sx]=x[0];
}
t=t+1;
wordnumber=sx;
for(s=1;s<wordnumber+1;s++){
h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(word[s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=word[s];
}
System.out.println(dicnumber);
}
}
writefile("dic.txt");
}
void writefile(String file){
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(file)));
for(s=1;s<dicnumber+1;s++){
pw.print(s);
pw.print(",");
pw.println(dic[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
int makenum(int year){
int mk;
mk=35;
if(year==13)mk=35;
if(year==14)mk=42;
if(year==15)mk=30;
if(year==16)mk=35;
if(year==17)mk=31;
if(year==18)mk=31;
if(year==19)mk=10;
return mk;
}
void readfile(String file){
String str;
BufferedReader br;
int s;
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年06月07日 18:35