for(Test test:tests)
{
int doc=0;
offset++;
int foffset=offset;
sheet.addCell(new Label(0, offset, "Test "+t));
t++;
double given[]=new double[XLSWriter.maxSenseNumbers];
double correct[]=new double[XLSWriter.maxSenseNumbers];
double ans[]=new double[XLSWriter.maxSenseNumbers];
double add[]=new double[XLSWriter.maxSenseNumbers];
double addc[]=new double[XLSWriter.maxSenseNumbers];
double pos[][]=new double[4][XLSWriter.maxSenseNumbers];
double posc[][]=new double[4][XLSWriter.maxSenseNumbers];
for(int i=0;i<XLSWriter.maxSenseNumbers;i++)
{
given[i]=0.0;
correct[i]=0.0;
ans[i]=0.0;
add[i]=0.0;
addc[i]=0.0;
for(int j=0;j<4;j++)
{
pos[j][i]=0.0;
posc[j][i]=0.0;
}
}
for(ArrayList<Decision> decisions:test.getAnswers())
{
offset++;
sheet.addCell(new Label(1, offset, test.getDocs().get(doc).toString()));
doc++;
offset++;
sheet.addCell(new Label(0, offset, "Sense number"));
sheet.addCell(new Label(1, offset, "Given answers"));
sheet.addCell(new Label(2, offset, "Correct answers"));
sheet.addCell(new Label(3, offset, "Total answers"));
sheet.addCell(new Label(4, offset, "Total addresed"));
sheet.addCell(new Label(5, offset, "Total addresed correctly"));
sheet.addCell(new Label(6, offset, "P"));
sheet.addCell(new Label(7, offset, "R"));
sheet.addCell(new Label(8, offset, "C"));
sheet.addCell(new Label(9, offset, "OverFit"));
sheet.addCell(new Label(10, offset, "Addressing precision"));
offset++;
double lgiven[]=new double[XLSWriter.maxSenseNumbers];
double lcorrect[]=new double[XLSWriter.maxSenseNumbers];
double lans[]=new double[XLSWriter.maxSenseNumbers];
double ladd[]=new double[XLSWriter.maxSenseNumbers];
double laddc[]=new double[XLSWriter.maxSenseNumbers];
for(int i=0;i<XLSWriter.maxSenseNumbers;i++)
{
lgiven[i]=0.0;
lcorrect[i]=0.0;
lans[i]=0.0;
ladd[i]=0.0;
laddc[i]=0.0;
}
for(Decision d:decisions)
{
for(int a:d.getAnswers())
{
lgiven[a]+=1.0;
given[a]+=1.0;
if(d.isCorrect(a))
{
lcorrect[a]+=1.0;
correct[a]+=1.0;
if(d.getTarget().getPos().equals(""))
posc[0][a]+=1.0;
else
posc[WordNet.getPOS(d.getTarget().getPos())][a]+=1.0;
}
if(d.getTarget().getPos().equals(""))
pos[0][a]+=1.0;
else
pos[WordNet.getPOS(d.getTarget().getPos())][a]+=1.0;
}
for(int a:d.getTarget().getCorrectSenseNumbers())
{
lans[a]+=1.0;
ans[a]+=1.0;
}
for(int a=0;a<d.getWeights().length;a++)
{
if(d.getWeights()[a]>0.0)
{
ladd[a]+=1.0;
add[a]+=1.0;
if(d.isCorrect(a))
{
laddc[a]+=1.0;
addc[a]+=1.0;
}
}
}
}
//Print
for(int i=0;i<10;i++)
{
sheet.addCell(new Label(0, offset, String.valueOf(i+1)));
sheet.addCell(new Number(1, offset, lgiven[i]));
sheet.addCell(new Number(2, offset, lcorrect[i]));
sheet.addCell(new Number(3, offset, lans[i]));
sheet.addCell(new Number(4, offset, ladd[i]));
sheet.addCell(new Number(5, offset, laddc[i]));
sheet.addCell(new Number(6, offset, 100.0*lcorrect[i]/lgiven[i]));
sheet.addCell(new Number(7, offset, 100.0*lcorrect[i]/lans[i]));
sheet.addCell(new Number(8, offset, 100.0*lgiven[i]/lans[i]));
sheet.addCell(new Number(9, offset, 100.0*ladd[i]/lans[i]-100.0));
sheet.addCell(new Number(10, offset, 100.0*laddc[i]/ladd[i]));
offset++;
}
}
sheet.addCell(new Label(12, foffset, "Overall"));
foffset++;
sheet.addCell(new Label(12, foffset, "Sense number"));
sheet.addCell(new Label(13, foffset, "Given answers"));
sheet.addCell(new Label(14, foffset, "Correct answers"));
sheet.addCell(new Label(15, foffset, "Total answers"));
sheet.addCell(new Label(16, foffset, "Total addresed"));
sheet.addCell(new Label(17, foffset, "Total addresed correctly"));
sheet.addCell(new Label(18, foffset, "P"));
sheet.addCell(new Label(19, foffset, "R"));
sheet.addCell(new Label(20, foffset, "C"));
sheet.addCell(new Label(21, foffset, "OverFit"));
sheet.addCell(new Label(22, foffset, "Addressing precision"));
sheet.addCell(new Label(23, foffset, "Noun P"));
sheet.addCell(new Label(24, foffset, "Verb P"));
sheet.addCell(new Label(25, foffset, "Adjective P"));
sheet.addCell(new Label(26, foffset, "Adverb P"));
foffset++;
for(int i=0;i<10;i++)
{
sheet.addCell(new Label(12, foffset, String.valueOf(i+1)));
sheet.addCell(new Number(13, foffset, given[i]));
sheet.addCell(new Number(14, foffset, correct[i]));
sheet.addCell(new Number(15, foffset, ans[i]));
sheet.addCell(new Number(16, foffset, add[i]));
sheet.addCell(new Number(17, foffset, addc[i]));