アットウィキロゴ

あrtf

import java.io.*;
import java.util.List;
import net.reduls.igo.Morpheme;
import net.reduls.igo.Tagger;

public class article{

String[] data=new String[50000];
String[] word=new String[1000];
String[] article=new String[50000];
String[] date=new String[50000];  
int s,sx,datanumber,wordnumber,articlenumber;
String file;
String str;
int page,p1,p2,p3,p4;
int n;

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

article(){        

sx=0;
for(page=1;page<46;page++){

file="memo/";
file=file+page;
file=file+".txt";

readfile(file);

for(s=1;s<datanumber+1;s++){
p1=data[s].indexOf("<");
p2=data[s].indexOf(">");
p3=data[s].indexOf("<",p2);
p4=data[s].indexOf(">",p3);
sx=sx+1;
date[sx]=data[s].substring(p1+1,p2);
article[sx]=data[s].substring(p3+1,p4);
}

}

articlenumber=sx;

for(n=1;n<100;n++){

makeword(article[n]);

for(s=1;s<wordnumber+1;s++){
System.out.println(word[s]);
}

}



}

void makeword(String str){
int s;
s=0;
try {
Tagger tagger = new Tagger( "ipadic" );
List<Morpheme> list = tagger.parse(str);          
for(Morpheme morph : list ){
s=s+1;            
word[s]=morph.surface;
}    

} catch(IOException e) { System.err.println(e.getMessage()); }

wordnumber=s;

}

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月07日 03:48