class pro{
String bun,word;
int[] x=new int[1000];
int[] y=new int[1000];
String jdata[]=new String[1000];
String surface[]=new String[1000];
String prop[]=new String[1000];
int s,jnumber;
String z1,z2;
public static void main(String args[]){
pro test=new pro();
}
pro(){
word="東京電力福島第一原発の事故による放射能汚染水の海への放出が10日にも終わる見通しになった。";
mecab mc=new mecab();
mc.makedata(word);
bun=mc.bun;
jmaker(bun);
for(s=1;s<jnumber+1;s++){
jdata[s]=jdatamaker(s,bun);
}
for(s=1;s<jnumber+1;s++){
String[] jx=jdata[s].split(",");
String[] jy=jx[0].split(":");
String[] jz=jx[1].split(":");
z1=jy[1];
z2=jz[1];
surface[s]=z1.substring(1,z1.length()-1);
prop[s]=z2.substring(2,z2.length()-1);
System.out.println(surface[s]);
System.out.println(prop[s]);
}
}
String jdatamaker(int s,String str){
int p1,p2;
String bara;
p1=x[s];
p2=y[s];
bara=str.substring(p1+1,p2);
return bara;
}
void jmaker(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;
}
jnumber=s;
for(s=1;s<jnumber+1;s++){
y[s]=str.indexOf("}",x[s]);
}
}
}
最終更新:2011年04月10日 07:25