src/main/java/eu/digitisation/distance/EditSequence.java
public BiCounter<Character, EdOp> stats(String s1, String s2, EdOpWeight w) {
        BiCounter<Character, EdOp> stats = new BiCounter<Character, EdOp>();
        int n1 = 0;
        int n2 = 0;
        for (EdOp op : ops) {
            switch (op) {
                case INSERT:
                    if (w.ins(s2.charAt(n2)) > 0) {
                        stats.inc(s2.charAt(n2), op);
                    } // costless insertion is equivalent to neglegible character
                    ++n2;
                    break;
                case SUBSTITUTE:
                    if (w.sub(s1.charAt(n1), s2.charAt(n2)) > 0) {
                        stats.inc(s1.charAt(n1), op);
                    } else {  // costless SUBSTITUTE is equivalent to KEEP
                        stats.inc(s1.charAt(n1), EdOp.KEEP);
                    }
                    ++n1;
                    ++n2;
                    break;
                case DELETE:
                    if (w.del(s1.charAt(n1)) > 0) {
                        stats.inc(s1.charAt(n1), op);
                    } // costless deletion is equivalent to neglegible character
                    ++n1;
                    break;
                case KEEP:
                    stats.inc(s1.charAt(n1), op);
                    ++n1;
                    ++n2;
                    break;
            }
        }
        return stats;
    }
/**
     * Extract alignment statistics
     *
     * @param s1 the source string
     * @param s2 the target string
     * @param w weights of basic edit operations
     * @return the statistics on the number of edit operations (per character
     * and type of operation)
     */
Extract alignment statistics
@param s1 the source string
@param s2 the target string
@param w weights of basic edit operations
@return the statistics on the number of edit operations (per character
and type of operation)
Extract alignment statistics @param s1 the source string @param s2 the target string @param w weights of basic edit operations @return the statistics on the number of edit operations ( per character and type of operation )
public BiCounter<Character, EdOp> stats(String s1, String s2, EdOpWeight w) {
        BiCounter<Character, EdOp> stats = new BiCounter<Character, EdOp>();
        int n1 = 0;
        int n2 = 0;
        for (EdOp op : ops) {
            switch (op) {
                case INSERT:
                    if (w.ins(s2.charAt(n2)) > 0) {
                        stats.inc(s2.charAt(n2), op);
                    } 
                    ++n2;
                    break;
                case SUBSTITUTE:
                    if (w.sub(s1.charAt(n1), s2.charAt(n2)) > 0) {
                        stats.inc(s1.charAt(n1), op);
                    } else {  
                        stats.inc(s1.charAt(n1), EdOp.KEEP);
                    }
                    ++n1;
                    ++n2;
                    break;
                case DELETE:
                    if (w.del(s1.charAt(n1)) > 0) {
                        stats.inc(s1.charAt(n1), op);
                    } 
                    ++n1;
                    break;
                case KEEP:
                    stats.inc(s1.charAt(n1), op);
                    ++n1;
                    ++n2;
                    break;
            }
        }
        return stats;
    }
public BiCounter < Character , EdOp > stats ( String s1 , String s2 , EdOpWeight w ) { BiCounter < Character , EdOp > stats = new BiCounter < Character , EdOp > ( ) ; int n1 = 0 ; int n2 = 0 ; for ( EdOp op : ops ) { switch ( op ) { case INSERT : if ( w . ins ( s2 . charAt ( n2 ) ) > 0 ) { stats . inc ( s2 . charAt ( n2 ) , op ) ; } ++ n2 ; break ; case SUBSTITUTE : if ( w . sub ( s1 . charAt ( n1 ) , s2 . charAt ( n2 ) ) > 0 ) { stats . inc ( s1 . charAt ( n1 ) , op ) ; } else { stats . inc ( s1 . charAt ( n1 ) , EdOp . KEEP ) ; } ++ n1 ; ++ n2 ; break ; case DELETE : if ( w . del ( s1 . charAt ( n1 ) ) > 0 ) { stats . inc ( s1 . charAt ( n1 ) , op ) ; } ++ n1 ; break ; case KEEP : stats . inc ( s1 . charAt ( n1 ) , op ) ; ++ n1 ; ++ n2 ; break ; } } return stats ; }
Extract alignment statistics
 @param s1 the source string
 @param s2 the target string
 @param w weights of basic edit operations
 @return the statistics on the number of edit operations (per character
 and type of operation)
Extract alignment statistics @param s1 the source string @param s2 the target string @param w weights of basic edit operations @return the statistics on the number of edit operations ( per character and type of operation )
// costless insertion is equivalent to neglegible character // costless SUBSTITUTE is equivalent to KEEP // costless deletion is equivalent to neglegible character