src/main/java/eu/digitisation/output/CharStatTable.java
public Element asTable() {
        DocumentBuilder builder = new DocumentBuilder("table");
        Element table = builder.root();
        Element row = builder.addElement("tr");

        // features
        table.setAttribute("border", "1");
        // header
        builder.addTextElement(row, "td", "Character");
        builder.addTextElement(row, "td", "Hex code");
        builder.addTextElement(row, "td", "Total");
        builder.addTextElement(row, "td", "Spurious");
        builder.addTextElement(row, "td", "Confused");
        builder.addTextElement(row, "td", "Lost");
        builder.addTextElement(row, "td", "Error rate");

        // content 
        for (Character c : leftKeySet()) {
            int spu = value(c, EdOp.INSERT);
            int sub = value(c, EdOp.SUBSTITUTE);
            int add = value(c, EdOp.DELETE);
            int tot = value(c, EdOp.KEEP) + sub + add;
            double rate = (spu + sub + add) / (double) tot * 100;
            row = builder.addElement("tr");
            builder.addTextElement(row, "td", c.toString());
            builder.addTextElement(row, "td", Integer.toHexString(c));
            builder.addTextElement(row, "td", "" + tot);
            builder.addTextElement(row, "td", "" + spu);
            builder.addTextElement(row, "td", "" + sub);
            builder.addTextElement(row, "td", "" + add);
            builder.addTextElement(row, "td", String.format("%.2f", rate));
        }
        return builder.document().getDocumentElement();
    }
/**
     * Separate statistics of errors for every character
     *
     * @return an element containing table with the statistics: one character
     * per row and one edit operation per column.
     */
Separate statistics of errors for every character
@return an element containing table with the statistics: one character
per row and one edit operation per column.
Separate statistics of errors for every character @return an element containing table with the statistics : one character per row and one edit operation per column .
public Element asTable() {
        DocumentBuilder builder = new DocumentBuilder("table");
        Element table = builder.root();
        Element row = builder.addElement("tr");
        table.setAttribute("border", "1");
        builder.addTextElement(row, "td", "Character");
        builder.addTextElement(row, "td", "Hex code");
        builder.addTextElement(row, "td", "Total");
        builder.addTextElement(row, "td", "Spurious");
        builder.addTextElement(row, "td", "Confused");
        builder.addTextElement(row, "td", "Lost");
        builder.addTextElement(row, "td", "Error rate");
        for (Character c : leftKeySet()) {
            int spu = value(c, EdOp.INSERT);
            int sub = value(c, EdOp.SUBSTITUTE);
            int add = value(c, EdOp.DELETE);
            int tot = value(c, EdOp.KEEP) + sub + add;
            double rate = (spu + sub + add) / (double) tot * 100;
            row = builder.addElement("tr");
            builder.addTextElement(row, "td", c.toString());
            builder.addTextElement(row, "td", Integer.toHexString(c));
            builder.addTextElement(row, "td", "" + tot);
            builder.addTextElement(row, "td", "" + spu);
            builder.addTextElement(row, "td", "" + sub);
            builder.addTextElement(row, "td", "" + add);
            builder.addTextElement(row, "td", String.format("%.2f", rate));
        }
        return builder.document().getDocumentElement();
    }
public Element asTable ( ) { DocumentBuilder builder = new DocumentBuilder ( "table" ) ; Element table = builder . root ( ) ; Element row = builder . addElement ( "tr" ) ; table . setAttribute ( "border" , "1" ) ; builder . addTextElement ( row , "td" , "Character" ) ; builder . addTextElement ( row , "td" , "Hex code" ) ; builder . addTextElement ( row , "td" , "Total" ) ; builder . addTextElement ( row , "td" , "Spurious" ) ; builder . addTextElement ( row , "td" , "Confused" ) ; builder . addTextElement ( row , "td" , "Lost" ) ; builder . addTextElement ( row , "td" , "Error rate" ) ; for ( Character c : leftKeySet ( ) ) { int spu = value ( c , EdOp . INSERT ) ; int sub = value ( c , EdOp . SUBSTITUTE ) ; int add = value ( c , EdOp . DELETE ) ; int tot = value ( c , EdOp . KEEP ) + sub + add ; double rate = ( spu + sub + add ) / ( double ) tot * 100 ; row = builder . addElement ( "tr" ) ; builder . addTextElement ( row , "td" , c . toString ( ) ) ; builder . addTextElement ( row , "td" , Integer . toHexString ( c ) ) ; builder . addTextElement ( row , "td" , "" + tot ) ; builder . addTextElement ( row , "td" , "" + spu ) ; builder . addTextElement ( row , "td" , "" + sub ) ; builder . addTextElement ( row , "td" , "" + add ) ; builder . addTextElement ( row , "td" , String . format ( "%.2f" , rate ) ) ; } return builder . document ( ) . getDocumentElement ( ) ; }
Separate statistics of errors for every character
 @return an element containing table with the statistics: one character
 per row and one edit operation per column.
Separate statistics of errors for every character @return an element containing table with the statistics : one character per row and one edit operation per column .
// features // header // content 