アットウィキロゴ

メインkkkk

import java.io.*;

class pro{

String bun,word;
String urlx;
int[] x=new int[10000];
int[] y=new int[10000];
int[] cx=new int[10000];
int[] cy=new int[10000];
int[] word1=new int[100];
int[] word2=new int[100];
int c,cs,s,t,s1,s2,sx,xmlnumber,cnumber,sx1,sx2;
int wordnumber,datanumber,xnumber;
String[] xml=new String[10000];
String[] credit=new String[10000];
String[] surface=new String[100];
String[] pos=new String[100];
String[] reading=new String[100];
String[] dsurface=new String[10000];
String[] dpos=new String[10000];
String[] dreading=new String[10000];

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

pro(){

urlx="http://www.hyuki.com/trans/prince.html";

getdata gt=new getdata();
gt.makedata(urlx);
bun=gt.bun;

xymaker(bun);
creditmaker(bun);

bun="";
for(s=1;s<xmlnumber;s++){
bun=bun+credit[s];
}


String[] z=bun.split("。");

System.out.println(z.length);

cs=0;
for(t=1;t<z.length;t++){
yahoo yh=new yahoo();
yh.makedata(z[t]);
bun=yh.bun;

System.out.println(z[t]);

yahoomaker(bun);

wordmaker(sx1,sx2);

surfacemaker();
readingmaker();
posmaker();

for(c=1;c<wordnumber+1;c++){
cs=cs+1;
dsurface[cs]=surface[c];
dpos[cs]=pos[c];
dreading[cs]=reading[c];
}

}

xnumber=cs;

makefile("ren.txt");


}

void makefile(String file){

try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(c=1;c<xnumber+1;c++){
pw.print("<");  
pw.print(c);  
pw.print(">");  
pw.print("<");  
pw.print(dsurface[c]);  
pw.print(">");
pw.print("<");  
pw.print(dreading[c]);  
pw.print(">");
pw.print("<");  
pw.print(dpos[c]);  
pw.println(">");
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }


}

void posmaker(){
String str3,str4;
int p1,p2,sxs;

for(s=1;s<wordnumber+1;s++){

p1=word1[s];
p2=word2[s];

str3="pos";

sxs=0;
for(sx=p1;sx<p2;sx++){
if(xml[sx].indexOf(str3)==0)sxs=sx;
}
pos[s]=credit[sxs];
}


}


void readingmaker(){
String str3,str4;
int p1,p2,sxs;

for(s=1;s<wordnumber+1;s++){

p1=word1[s];
p2=word2[s];

str3="reading";

sxs=0;
for(sx=p1;sx<p2;sx++){
if(xml[sx].indexOf(str3)==0)sxs=sx;
}
reading[s]=credit[sxs];
}


}




void surfacemaker(){
String str3,str4;
int p1,p2,sxs;

for(s=1;s<wordnumber+1;s++){

p1=word1[s];
p2=word2[s];

str3="surface";

sxs=0;
for(sx=p1;sx<p2;sx++){
if(xml[sx].indexOf(str3)==0)sxs=sx;
}
surface[s]=credit[sxs];
}


}

void wordmaker(int sx1,int sx2){
String str3,str4;
int p;

str3="word";
str4="/word";

p=0;
for(sx=sx1;sx<sx2;sx++){
if(xml[sx].indexOf(str3)==0)p=p+1;
if(xml[sx].indexOf(str3)==0)word1[p]=sx;
}

wordnumber=p;

p=0;
for(sx=sx1;sx<sx2;sx++){
if(xml[sx].indexOf(str4)==0)p=p+1;
if(xml[sx].indexOf(str4)==0)word2[p]=sx;
}




}

void yahoomaker(String bun){

String str1,str2;

str1="ma_result";
str2="/ma_result";

xymaker(bun);
xmlmaker(bun);
creditmaker(bun);

sx1=0;
sx2=0;

for(sx=1;sx<xmlnumber;sx++){
if(xml[sx].indexOf(str1)==0)sx1=sx;
}

for(sx=1;sx<xmlnumber;sx++){
if(xml[sx].indexOf(str2)==0)sx2=sx;
}

System.out.println(sx1);
System.out.println(sx2);

}

void creditmaker(String str){
int p1,p2;  
for(s=1;s<xmlnumber;s++){
p1=y[s];
p2=x[s+1];
credit[s]="";
if(p2>p1)credit[s]=str.substring(p1+1,p2);
}
}

void xmlmaker(String str){
int p1,p2;  
for(s=1;s<xmlnumber+1;s++){
p1=x[s];
p2=y[s];
xml[s]="";
if(p2>p1)xml[s]=str.substring(p1+1,p2);
}
}

void xymaker(String str){
int p1;
int s;
s=1;
p1=str.indexOf("<");
x[1]=p1;
while(p1>-1){
p1=str.indexOf("<",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]=str.indexOf(">",x[s]);
}

}


}
最終更新:2011年04月21日 18:09