PFABuilder

trait PFABuilder[S, T, +A <: (PFA), -K >: PFAelements[S, T] <: Matchable, -Z <: (ProbabilisticAutomatonStyle)] extends PFABuilder[S, T, A, K, Z] with StatesMixin[S, T] with UnindexedPFA[S, T, Z]

Implementation of PFABuilder using `HashSet`s and `HashMap`s.

Type Params
S

The type of all states of the automaton

T

The type of labels on (non-epsilon) transitions of the automaton

Value Params
initialState

The initial state of the automaton. This builder must be instantiated with one state, initially taken to be the initial state.

trait UnindexedPFA[S, T, Z]
trait UnindexedFA[S, T, Z]
trait StatesMixin[S, T]
trait PFABuilder[S, T, A, K, Z]
trait UnindexedPFA[S, T, Z]
trait UnindexedFA[S, T, Z]
trait Pretty
trait Graphable[S, T, Z]
trait Builder[K, A[S, T]]
trait Growable[K]
trait Clearable
class Object
trait Matchable
class Any
class PFABuilder[S, T]

Value members

Abstract methods

protected
def assemblePFA(statesSeq: IndexedSeq[S], initialProbs: Array[Double], finalProbs: Array[Double], transitionsSeq: IndexedSeq[T], idxLabels: Array[Array[Array[Double]]], eTransLabels: Array[Array[Double]]): A[S, T]

Concrete methods

override
def acceptsProb(ts: Seq[T]): Double
Definition Classes
def addETransition(s1: S, s2: S, prob: Double): Unit
def addFinalState(s: S, prob: Double): Unit
def addInitialState(s: S, prob: Double): Unit
override
def addOne(builder: K): PFABuilder[S, T, A, K, Z]
Definition Classes
def addTransition(s1: S, t: T, s2: S, prob: Double): Unit
override
def clear(): Unit
Definition Classes
protected
def eTransition(s0: S, s1: S): Double
override
Definition Classes
def eTransitionProb(s0: S, s1: S): Double
def foreachETransition(action: (S, S, Double) => Unit): Unit
def foreachFinalState(action: (S, Double) => Unit): Unit
def foreachInitialState(action: (S, Double) => Unit): Unit
def foreachState(action: (S, Double) => Unit): Unit
def foreachTransition(action: (S, T, S, Double) => Unit): Unit
def labels: Set[T]
override
def map[S2, T2](stateMap: S => S2, transitionMap: T => T2): PFA[S2, T2, Z]
Definition Classes
override
def mapStates[S2](stateMap: S => S2): PFA[S2, T, Z]
Definition Classes
override
def mapTransitions[T2](transitionMap: T => T2): PFA[S, T2, Z]
Definition Classes
def removeETransition(s1: S, s2: S): Unit
Definition Classes
def removeTransition(s1: S, t: T, s2: S): Unit
def result(): A[S, T]
def transition(s0: S, t: T, s1: S): Double
def transition(s0: S, t: T): Map[S, Double]
def transitionProb(s0: S, t: T, s1: S): Double

Inherited methods

final
def ++=(xs: IterableOnce[K]): PFABuilder[S, T, A, K, Z]
Inherited from
Growable
final
def +=(elem: K): PFABuilder[S, T, A, K, Z]
Inherited from
Growable
override
def accepts(s: Seq[T]): Boolean
Definition Classes
Inherited from
UnindexedPFA
def addAll(xs: IterableOnce[K]): PFABuilder[S, T, A, K, Z]
Inherited from
Growable
def addState(s: S): Unit
Inherited from
StatesMixin
protected
def afterStatePlot(sb: StringBuilder, style: Z[S, T], stateList: IndexedSeq[S], stateMap: Map[S, Int]): Unit
Inherited from
UnindexedFA
protected
def assemblePrettyTransition(before: Doc, arrow: Doc, after: Doc): Doc
Inherited from
UnindexedFA
protected
Inherited from
UnindexedFA
def dump(out: PrintStream): Unit
Inherited from
UnindexedFA
override protected
def edgeText(style: Z[S, T], si0: Int, s0: S, si1: Int, s1: S): String
Definition Classes
Inherited from
UnindexedPFA
override protected
def edgeText(style: Z[S, T], si0: Int, s0: S, ti0: Int, t: T, si1: Int, s1: S): String
Definition Classes
Inherited from
UnindexedPFA
override

Returns the Set of final states in this automaton. For PFAs, this method returns the states which map via [[org.maraist.fa.PFA#finalStateProb]] to a non-zero probability.

Returns the Set of final states in this automaton. For PFAs, this method returns the states which map via [[org.maraist.fa.PFA#finalStateProb]] to a non-zero probability.

Definition Classes
Inherited from
UnindexedPFA
protected
Inherited from
UnindexedFA
override
def foreachETransition(action: (S, S) => Unit): Unit
Definition Classes
Inherited from
UnindexedPFA
override
def foreachFinalState(action: S => Unit { def apply(s: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
override
def foreachInitialState(action: S => Unit { def apply(s: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
override
def foreachState(action: S => Unit { def apply(s: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
override
def foreachTransition(action: (S, T, S) => Unit { def apply(s1: S, t: T, s2: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
def graphviz(sourceFile: String, outputFile: String)(using options: Z[S, T]): Unit

Use Graphviz to render this object as specified.

Use Graphviz to render this object as specified.

Inherited from
Graphable
def graphviz(fileRoot: String)(using options: Z[S, T]): Unit

Use Graphviz to render this object (in the default format) to the given file.

Use Graphviz to render this object (in the default format) to the given file.

Inherited from
Graphable
protected
def initPlot(sb: StringBuilder, states: Int, labels: Int): Unit
Inherited from
UnindexedFA
override

Returns the Set of initial states in this automaton. For PFAs, this method returns the states which map via [[org.maraist.fa.PFA#initialStateProb]] to a non-zero probability.

Returns the Set of initial states in this automaton. For PFAs, this method returns the states which map via [[org.maraist.fa.PFA#initialStateProb]] to a non-zero probability.

Definition Classes
Inherited from
UnindexedPFA
protected
def internalsToDOT(stateList: IndexedSeq[S], stateMap: Map[S, Int], theLabels: IndexedSeq[T], sb: StringBuilder)(using style: Z[S, T]): Unit

Internal routine used by [[#toDOT]]. Subclesses may override, but still call super.internalsToDOT, to extend the Graphviz representation of a DFA.

Internal routine used by [[#toDOT]]. Subclesses may override, but still call super.internalsToDOT, to extend the Graphviz representation of a DFA.

Inherited from
UnindexedFA
override
Definition Classes
Inherited from
UnindexedPFA
override

Returns whether the given state s is initial in this automaton. For PFAs, this method returns true if s has a non-zero chance of being an initial state of the automaton.

Returns whether the given state s is initial in this automaton. For PFAs, this method returns true if s has a non-zero chance of being an initial state of the automaton.

Definition Classes
Inherited from
UnindexedPFA
def isState(s: S): Boolean
Inherited from
StatesMixin
Inherited from
Growable
def mapResult[NewTo](f: A[S, T] => NewTo): Builder[K, NewTo]
Inherited from
Builder
protected
Inherited from
UnindexedPFA
override protected
def plotInitialStateMarker(sb: StringBuilder, style: Z[S, T], s: S, idx: Int): Unit
Definition Classes
Inherited from
UnindexedPFA
protected
def plotPresentEdge(sb: StringBuilder, style: Z[S, T], stateList: IndexedSeq[S], stateMap: Map[S, Int], si0: Int, s0: S, si1: Int, s1: S): Unit
Inherited from
UnindexedFA
protected
def plotPresentEdge(sb: StringBuilder, style: Z[S, T], stateList: IndexedSeq[S], stateMap: Map[S, Int], si0: Int, s0: S, ti0: Int, t: T, si1: Int, s1: S): Unit
Inherited from
UnindexedFA
protected
def plotState(sb: StringBuilder, style: Z[S, T], si: Int, s: S, isInitial: Boolean, isFinal: Boolean): Unit
Inherited from
UnindexedFA
protected
def plotTransitions(stateList: IndexedSeq[S], stateMap: Map[S, Int], theLabels: IndexedSeq[T], sb: StringBuilder, style: Z[S, T]): Unit
Inherited from
UnindexedFA
Inherited from
UnindexedPFA
def pretty: Doc
Inherited from
UnindexedFA
protected
def prettyETransition(src: S, dest: S): Doc
Inherited from
UnindexedFA
protected
def prettyETransitionArrow(src: S, dest: S): Doc
Inherited from
UnindexedFA
protected
def prettyFooter: Doc
Inherited from
UnindexedFA
protected
def prettyHeader: Doc
Inherited from
UnindexedFA
protected
def prettyState(s: S): Doc
Inherited from
UnindexedFA
protected
def prettyStateInTransition(state: S): Doc
Inherited from
UnindexedFA
protected
def prettyStateLeader(s: S): Doc
Inherited from
UnindexedFA
protected
def prettyStates: Doc
Inherited from
UnindexedFA
protected
def prettyTransition(src: S, label: T, dest: S): Doc
Inherited from
UnindexedFA
protected
def prettyTransitionArrow(src: S, label: T, dest: S): Doc
Inherited from
UnindexedFA
protected
Inherited from
UnindexedFA
def removeState(s: S): Unit
Inherited from
StatesMixin
def size: Int
Inherited from
StatesMixin
final
def sizeHint(coll: IterableOnce[_], delta: Int): Unit
Inherited from
Builder
def sizeHint(size: Int): Unit
Inherited from
Builder
final
def sizeHintBounded(size: Int, boundingColl: Iterable[_]): Unit
Inherited from
Builder
def states: Set[S]
Inherited from
StatesMixin
override
def toDOT(using Z[S, T]): String
Definition Classes
UnindexedFA -> Graphable
Inherited from
UnindexedFA
override
Definition Classes
Inherited from
UnindexedPFA
override
Definition Classes
Inherited from
UnindexedFA
override
def transitions(s: S, t: T): Set[S]
Definition Classes
Inherited from
UnindexedPFA

Deprecated and Inherited methods

@inline @deprecated(message = "Use `++=` aka `addAll` instead of varargs `+=`; infix operations with an operand of multiple args will be deprecated", since = "2.13.0")
final
def +=(elem1: K, elem2: K, elems: K*): PFABuilder[S, T, A, K, Z]
Deprecated
[Since version 2.13.0] Use `++=` aka `addAll` instead of varargs `+=`; infix operations with an operand of multiple args will be deprecated
Inherited from
Growable

Concrete fields

protected
protected

Inherited fields

protected

Storage for all state objects

Storage for all state objects

Inherited from
StatesMixin