sym.md

@include "au"
@include "col"

function Sym(i,pos,txt,w) {
  isa(Col(i,pos,txt,w))
  i.mode = ""
  i.most = 0
  i.ent =""
  i.ignore="?"
  has(i,"counts")
}
function SymAdd(i,x,   tmp) {
  if( x == i.ignore ) return x
  i.n++
  tmp = i.counts[x] = i.counts[x] + 1
  if(tmp > i.mode) {
    i.most = tmp
    i.mode = x
  }
  return  x
}
function SymEnt(i,   x,p) {
  i.ent=0
  for(x in i.counts) {
    p = i.counts[x]/i.n
    i.ent -= p * log(p) / log(2)
  }
  return i.ent
}