Module Automata.WFA

Weighted finite automaton (WFA) parameterised over a semiring.

A WFA is a triple (ι, δ, λ): ι is the initial weight row-vector, δ maps each character to a transition matrix, and λ is the output column-vector. Semantics: outs aut w = ι · M(a₁) · … · M(aₙ) · λ.

type stats_dim = {
  1. states : Base.int;
  2. init : Base.int;
    (*

    Number of non-zero initial weights.

    *)
  3. fin : Base.int;
    (*

    Number of non-zero output weights.

    *)
  4. trans : Base.int;
    (*

    Total number of non-zero transition weights.

    *)
}

Structural statistics about a WFA, written to the output JSON.

val pp_stats_dim : Ppx_deriving_runtime.Format.formatter -> stats_dim -> Ppx_deriving_runtime.unit
val show_stats_dim : stats_dim -> Ppx_deriving_runtime.string
val stats_dim_of_yojson : Ppx_yojson_conv_lib.Yojson.Safe.t -> stats_dim
val yojson_of_stats_dim : stats_dim -> Ppx_yojson_conv_lib.Yojson.Safe.t
type stats_sym = {
  1. non_det : Base.int Base.list;
    (*

    Per-character count of states with ≠ 1 non-zero outgoing weight.

    *)
  2. avg_con : Base.float Base.list;
    (*

    Per-character average number of non-zero outgoing weights per state.

    *)
}

Symbolic structure statistics (non-determinism and average connectivity).

val pp_stats_sym : Ppx_deriving_runtime.Format.formatter -> stats_sym -> Ppx_deriving_runtime.unit
val show_stats_sym : stats_sym -> Ppx_deriving_runtime.string
val stats_sym_of_yojson : Ppx_yojson_conv_lib.Yojson.Safe.t -> stats_sym
val yojson_of_stats_sym : stats_sym -> Ppx_yojson_conv_lib.Yojson.Safe.t
type stats = {
  1. dim : stats_dim;
  2. sym : stats_sym;
}
val pp_stats : Ppx_deriving_runtime.Format.formatter -> stats -> Ppx_deriving_runtime.unit
val show_stats : stats -> Ppx_deriving_runtime.string
val stats_of_yojson : Ppx_yojson_conv_lib.Yojson.Safe.t -> stats
val yojson_of_stats : stats -> Ppx_yojson_conv_lib.Yojson.Safe.t
module type S = sig ... end

Minimal interface required of the state type (integer in practice).

module type T = sig ... end

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

module Make (S : Algebra.Semiring.T) : T with type s = S.t