{
super(dict,name);
this.dict=dict;
File tmp=new File("./data/matrices/"+dict.getCompleteName().replace(">", "@@@@@")+"/");
tmp.mkdirs();
Wiki wiki=(Wiki)this.dict;
for(Input doc:targets)
{
System.out.println("Calculating matrices for "+doc.toString());
for(AmbiguousWord word:doc.getAmbiguousWords())
{
if(word.getCurrentLemmaObject()!=null&&word.getSenses().size()>0&&word.getSenses().size()<150)
{
System.out.print(".");
File fout=new File("./data/matrices/"+dict.getCompleteName().replace(">", "@@@@@")+"/"+Dictionary.normalizeLemmaforFile(word.getLemma())+".gmx");;
if(!fout.exists())
{
SmallPair p=new SmallPair(word.getLemmaObject());
for(int i=0;i<p.getLemma().getSenses().size();i++)
{
p.getCounts()[i][i]=(int)wiki.getCounts(p.getLemma().getSenses().get(i),p.getLemma().getSenses().get(i));
for(int j=0;j<p.getLemma().getSenses().size();j++)
{
if(p.getCounts()[i][i]<(2*p.getLemma().getSenses().size()))
{
if(p.getCounts()[i][i]==0)
{
p.getCounts()[i][j]=1;
p.getCounts()[j][i]=1;
}
else
{
p.getCounts()[i][j]=p.getCounts()[i][i];
p.getCounts()[j][i]=p.getCounts()[i][i];
}
}
else
{
if(j>i)
{
p.getCounts()[i][j]=0;
}
}
}
}
for(int i=0;i<p.getLemma().getSenses().size();i++)
{
for(int j=i+1;j<p.getLemma().getSenses().size();j++)
{
if(p.getCounts()[i][i]>=(2*p.getLemma().getSenses().size())&&p.getCounts()[j][j]>=(2*p.getLemma().getSenses().size()))
{
p.getCounts()[i][j]=(int)wiki.getCounts(p.getLemma().getSenses().get(i),p.getLemma().getSenses().get(j));
p.getCounts()[j][i]=p.getCounts()[i][j];
if(p.getCounts()[j][i]>=(2*p.getLemma().getSenses().size()))
{
i=p.getLemma().getSenses().size();
break;