Struct Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder
Builder struct for a state
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions.Automata
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public struct StateBuilder
Remarks
Implemented as value type to minimize gc.
Properties
CanEnd
Gets a value indicating whether the ending weight of this state is greater than zero.
Declaration
public readonly bool CanEnd { get; }
Property Value
Type | Description |
---|---|
Boolean |
EndWeight
Gets or sets the ending weight of the state.
Declaration
public readonly Weight EndWeight { get; }
Property Value
Type | Description |
---|---|
Weight |
HasTransitions
Gets a value indicating whether this state is a start state for any transitions.
Declaration
public readonly bool HasTransitions { get; }
Property Value
Type | Description |
---|---|
Boolean |
Index
Index of current state.
Declaration
public readonly int Index { get; }
Property Value
Type | Description |
---|---|
Int32 |
TransitionIterator
Gets TransitionIterator over transitions of this state.
Declaration
public readonly Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.TransitionIterator TransitionIterator { get; }
Property Value
Type | Description |
---|---|
Automaton.Builder.TransitionIterator<> |
Methods
AddEpsilonTransition(Weight, Nullable<Int32>, Int32)
Adds an epsilon transition to the current state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddEpsilonTransition(Weight weight, int? destinationStateIndex = null, int group = 0)
Parameters
Type | Name | Description |
---|---|---|
Weight | weight | The transition weight. |
Nullable<Int32> | destinationStateIndex | The destination state of the added transition. If the value of this parameter is null, a new state will be created. |
Int32 | group | The group of the added transition. |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> | The destination state of the added transition. |
AddSelfTransition(TElement, Weight, Int32)
Adds a self-transition labeled with a given element to the current state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddSelfTransition(TElement element, Weight weight, int group = 0)
Parameters
Type | Name | Description |
---|---|---|
TElement | element | The element. |
Weight | weight | The transition weight. |
Int32 | group | The group of the added transition. |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> | The current state. |
AddSelfTransition(Option<TElementDistribution>, Weight, Byte)
Adds a self-transition to the current state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddSelfTransition(Option<TElementDistribution> elementDistribution, Weight weight, byte group = 0)
Parameters
Type | Name | Description |
---|---|---|
Option<TElementDistribution> | elementDistribution | The element distribution associated with the transition. If the value of this parameter is null, an epsilon transition will be created. |
Weight | weight | The transition weight. |
Byte | group | The group of the added transition. |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> | The current state. |
AddTransition(TElement, Weight, Nullable<Int32>, Int32)
Adds a transition labeled with a given element to the current state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddTransition(TElement element, Weight weight, int? destinationStateIndex = null, int group = 0)
Parameters
Type | Name | Description |
---|---|---|
TElement | element | The element. |
Weight | weight | The transition weight. |
Nullable<Int32> | destinationStateIndex | The destination state of the added transition. If the value of this parameter is null, a new state will be created. |
Int32 | group | The group of the added transition. |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> | The destination state of the added transition. |
AddTransition(Option<TElementDistribution>, Weight, Nullable<Int32>, Int32)
Adds a transition to the current state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddTransition(Option<TElementDistribution> elementDistribution, Weight weight, int? destinationStateIndex = null, int group = 0)
Parameters
Type | Name | Description |
---|---|---|
Option<TElementDistribution> | elementDistribution | The element distribution associated with the transition. If the value of this parameter is null, an epsilon transition will be created. |
Weight | weight | The transition weight. |
Nullable<Int32> | destinationStateIndex | The destination state of the added transition. If the value of this parameter is null, a new state will be created. |
Int32 | group | The group of the added transition. |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> | The destination state of the added transition. |
AddTransition(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Transition)
Adds a transition to the current state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddTransition(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Transition transition)
Parameters
Type | Name | Description |
---|---|---|
Automaton.Transition<> | transition |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> |
Remarks
Transitions are stored in linked list over an array. This function updates this linked list and pointers into it. It involves a lot of bookkeeping.
AddTransitionsForSequence(TSequence, Nullable<Int32>, Int32)
Adds a series of transitions labeled with the elements of a given sequence to the current state, as well as the intermediate states. All the added transitions have unit weight.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder AddTransitionsForSequence(TSequence sequence, int? destinationStateIndex = null, int group = 0)
Parameters
Type | Name | Description |
---|---|---|
TSequence | sequence | The sequence. |
Nullable<Int32> | destinationStateIndex | The last state in the transition series. If the value of this parameter is null, a new state will be created. |
Int32 | group | The group of the added transitions. |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> | The last state in the added transition series. |
SetEndWeight(Weight)
Sets a new end weight for this state.
Declaration
public Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder.StateBuilder SetEndWeight(Weight weight)
Parameters
Type | Name | Description |
---|---|---|
Weight | weight |
Returns
Type | Description |
---|---|
Automaton.Builder.StateBuilder<> |