package tv;
import tool.*;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] credit=new String[5000];
String[] dic=new String[5000];
int dicnumber;
String[] art=new String[5000];
String[] subdata=new String[500000];
int number;
public static void main(String[] args) {
pro yt=new pro();
}
pro(){
int nx=0;
int tr;
for(tr=1;tr<2766;tr++){
readfile sub32=new readfile();
sub32.makedata("data/"+tr+".txt","UTF-8");
data=sub32.data;
datanumber=sub32.datanumber;
for(s=1;s<datanumber+1;s++){
int p1=data[s].indexOf("<");
int p2=data[s].indexOf(">");
credit[s]=data[s].substring(p1+1,p2);
}
int sx;
for(s=1;s<datanumber+1;s++){
int h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(credit[s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=credit[s];
}
}
for(tr=1;tr<2766;tr++){
readfile sub32=new readfile();
sub32.makedata("data/"+tr+".txt","UTF-8");
data=sub32.data;
datanumber=sub32.datanumber;
for(s=1;s<datanumber+1;s++){
int p1=data[s].indexOf("<");
int p2=data[s].indexOf(">");
credit[s]=data[s].substring(p1+1,p2);
}
String str="";
for(s=1;s<datanumber+1;s++){
if(credit[s].equals(dic[3]))str=data[s];
}
int p3=str.indexOf(">");
if(p3>0)str=str.substring(p3+1,str.length());
String[] x=str.split("△");
for(s=0;s<x.length;s++){
art[s+1]=change(x[s]);
}
int delta=x.length;
for(s=1;s<delta+1;s++){
if(art[s].length()>0)nx=nx+1;
if(art[s].length()>0)subdata[nx]=tr+","+art[s];
}
}
number=nx;
writexml("ren.csv");
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<number+1;s++){
pw.println(subdata[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
String check(String c){
if(c.indexOf(")")>-1)c="";
if(c.indexOf(")")>-1)c="";
if(c.indexOf("(")>-1)c="";
return c;
}
String change(String c){
String c2=c;
int k1=c.indexOf("(");
if(k1>0)c2=c.substring(0,k1);
int k2=c2.indexOf("(");
if(k2>0)c2=c2.substring(0,k2);
c2=check(c2);
return c2;
}
}
最終更新:2016年07月11日 02:56