アットウィキロゴ

自然言語cc

import java.io.*;

class nl{

String data;
int s,n,nx;
String[] ph=new String[500];
String[] word=new String[500];
int wordnumber,xnumber;

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

nl(){

readfile("700.txt");

String[] x=data.split("。");

nx=0;
for(s=0;s<x.length;s++){

makeword(x[s]);

for(n=1;n<wordnumber+1;n++){
nx=nx+1;
word[nx]=ph[n];
}

}

xnumber=nx;





}

void makeword(String str){
int num,sx,s;
int[] z=new int[500];
String[] part=new String[1000];
String q;
num=str.length();
for(s=0;s<num;s++){
part[s]=str.substring(s,s+1);
}

for(s=0;s<num-1;s++){
z[s]=0;
if(Math.random()>0.5)z[s]=1;
}

z[num-1]=1;

q="";
sx=0;
for(s=0;s<num;s++){
q=q+part[s];
if(z[s]==1)sx=sx+1;
if(z[s]==1)ph[sx]=q;
if(z[s]==1)q="";
}

wordnumber=sx;


}

void readfile(String file){

String str;
BufferedReader br;

data="";

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年05月21日 13:01