Class Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder
Helper class which is used to construct new automaton interactively using the builder pattern.
Inheritance
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions.Automata
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public class Builder
Constructors
Builder(Int32)
Creates a new empty Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.
Declaration
public Builder(int startStateCount = 1)
Parameters
Type | Name | Description |
---|---|---|
Int32 | startStateCount |
Properties
Item[Int32]
Returns Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder object for specified state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Property Value
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> |
Start
Returns Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder object for start state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder Start { get; }
Property Value
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> |
StartStateIndex
Index of the start state.
Declaration
public int StartStateIndex { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
StatesCount
Number of states which were created so far.
Declaration
public int StatesCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
TransitionsCount
Number of transitions which were created so far.
Declaration
public int TransitionsCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
AddState()
Adds new state and returns Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder for it.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddState()
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> |
AddStates(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.StateCollection)
Adds all states and transitions from some Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.StateCollection.
Declaration
public void AddStates(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.StateCollection states)
Parameters
Type | Name | Description |
---|---|---|
Automaton.StateCollection<> | states |
AddStates(Int32)
Adds count
new states/
Declaration
public void AddStates(int count)
Parameters
Type | Name | Description |
---|---|---|
Int32 | count |
Append(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>, Int32, Boolean)
Creates an automaton f'(s) = sum_{tu=s} f(t)g(u)
, where f(t)
is the current
automaton (in builder) and g(u)
is the given automaton.
The resulting automaton is also known as the Cauchy product of two automata.
Declaration
public (bool avoidedEpsilonTransitions, bool preservedDeterminizationState) Append(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis> automaton, int group = 0, bool avoidEpsilonTransitions = true)
Parameters
Type | Name | Description |
---|---|---|
Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis> | automaton | Given automaton. |
Int32 | group | If non-zero, all transitions in the appended part will be put into the specified group. |
Boolean | avoidEpsilonTransitions | When set to true (default), and at least one of the following |
Returns
Type | Description |
---|---|
(T1, T2)<Boolean, Boolean> | A pair of boolean values. The first indicates whether adding new epsilon transitions was avoided. The second indicates, whether the determinization state of the concatenated automata was preserved, i.e. whether both the current and the given automata being determinized implies that the result automaton is determinized as well. |
Clear()
Removes all states and transitions from builder returning it to empty state.
Declaration
public void Clear()
ConstantOn(Weight, TSequence)
Factory method which creates Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder and inserts into it an automaton
matching given sequence
with some weight
.
Declaration
public static Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder ConstantOn(Weight weight, TSequence sequence)
Parameters
Type | Name | Description |
---|---|---|
Weight | weight | |
TSequence | sequence |
Returns
Type | Description |
---|---|
Automaton.Builder<> |
FromAutomaton(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>)
Factory method which creates Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder which contains all states and transitions
from given automaton
.
Declaration
public static Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder FromAutomaton(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis> automaton)
Parameters
Type | Name | Description |
---|---|---|
Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis> | automaton |
Returns
Type | Description |
---|---|
Automaton.Builder<> |
GetAutomaton()
Builds new automaton object. Builder must not be used after this method is called
Declaration
public TThis GetAutomaton()
Returns
Type | Description |
---|---|
TThis |
GetData(Nullable<Boolean>)
Stores built automaton in pre-allocated Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis> object.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.DataContainer GetData(bool? isDeterminized = null)
Parameters
Type | Name | Description |
---|---|---|
Nullable<Boolean> | isDeterminized |
Returns
Type | Description |
---|---|
Automaton.DataContainer<> |
Remarks
Builder must not be used after this method is called.
RemoveState(Int32)
Removes state with given stateIndex
and all incoming transitions.
Declaration
public void RemoveState(int stateIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | stateIndex |
RemoveStates(Boolean[], Boolean)
Removes a set of states from the automaton where the set is defined by labels not matching
the removeLabel
.
Declaration
public int RemoveStates(bool[] labels, bool removeLabel)
Parameters
Type | Name | Description |
---|---|---|
Boolean[] | labels | State labels |
Boolean | removeLabel | Label which marks states which should be deleted |
Returns
Type | Description |
---|---|
Int32 |