アットウィキロゴ

IGO BUN

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

public class pro{

int n,datanumber;
String[] data=new String[50000];
int s,sx,wordnumber;
String[][] word=new String[101][5000];
String[] article=new String[50000];
String[] author=new String[50000];
String str;

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

pro(){        

readfile("article.txt");

sx=0;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
if(x.length>1)sx=sx+1;
if(x.length>1)author[sx]=x[0];
if(x.length>1)article[sx]=x[1];
}



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

System.out.println(author[n]);

str=article[n];

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

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

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

}


}
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月11日 20:10