Module type WFA.T

Module type for a concrete weighted finite automaton parametric in a semiring element type s.

A WFA is a triple (iota, delta, lambda): iota is a row vector of initial weights, delta maps each character to a transition matrix, and lambda is a column vector of output weights. The semantics of word w = a₁…aₙ is iota · M(a₁) · … · M(aₙ) · lambda.

type s
type t
module State : S with type t = Base.int
val mk : s Base.list -> s Base.list Char.map -> s Base.list -> t

mk init trans out constructs a WFA from flat lists. init has length n (one entry per state). trans maps each character to a flat list of length (row-major). out has length n.

val outs : t -> Word.t -> s

outs aut w evaluates the WFA on word w, returning iota · M(w) · lambda.

val to_string : t -> Base.string
val stats : t -> stats
val stats_to_string : t -> Base.string