import java.io.*;
import java.util.List;
import net.reduls.igo.Morpheme;
import net.reduls.igo.Tagger;
public class pro{
int n,datanumber,articlenumber;
String[] data=new String[50000];
int s,sx,wordnumber;
String[][] word=new String[3000][5000];
String[] article=new String[5000];
String str;
int h;
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(",");
h=0;
if(x.length>1)h=h+1;
if(x[0].equals("小泉議長"))h=h+1;
if(h==2)sx=sx+1;
if(h==2)article[sx]=x[1];
}
articlenumber=sx;
System.out.println(articlenumber);
for(n=1;n<articlenumber+1;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日 22:26