import java.io.*;
import java.net.URLEncoder;
class pro{
String urlx,word,str,bun;
String[] data=new String[100];
String[] ske=new String[100];
int[][] sdata=new int[60][50];
int num;
int wordnumber;
int datanumber;
int s,sx,day;
int t1,t2,y,m;
int z1;
public static void main(String [] args) {
pro test=new pro();
}
pro(){
readfile("ske.txt");
for(s=1;s<58;s++){
ske[s]=data[s];
}
for(t2=1;t2<58;t2++){
word=ske[t2];
y=2007;
m=12;
for(t1=1;t1<42;t1++){
m=m+1;
if(m>12)y=y+1;
if(m>12)m=1;
day=100*y+m;
try{
str = URLEncoder.encode(word,"utf-8");
}catch(Exception e) { System.err.println(e); }
urlx="http://stats.grok.se/ja/";
urlx=urlx+day;
urlx=urlx+"/";
urlx=urlx+str;
getdata gt=new getdata();
gt.makedata(urlx);
bun=gt.data;
xml x=new xml();
x.makedata(bun);
num=x.num;
System.out.print(word);
System.out.println(num);
sdata[t2][t1]=num;
}
}
writefile();
}
void writefile(){
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter("sdata.txt")));
for(s=1;s<58;s++){
for(sx=1;sx<41;sx++){
pw.print(sdata[s][sx]);
pw.print(",");
}
pw.println(sdata[s][41]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
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月24日 12:37