Class RegexpTreeNode<TElement, TElementSet>
Represents a node in the tree describing a regular expression.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions.Automata
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public class RegexpTreeNode<TElement, TElementSet>
where TElementSet : CanCreatePartialUniform<TElementSet>, IImmutableDistribution<TElement, TElementSet>, new()
Type Parameters
Name | Description |
---|---|
TElement | The type of a character in a language word. |
TElementSet | The type of a sequence element set. |
Remarks
Although this class might look immutable, Microsoft.ML.Probabilistic.Distributions.Automata.RegexpTreeNode`2.Simplify(System.Boolean) can change the tree rooted at the node by removing existing children and/or adding new.
Properties
Children
Gets the children of the node.
Declaration
public ReadOnlyCollection<RegexpTreeNode<TElement, TElementSet>> Children { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<RegexpTreeNode<TElement, TElementSet>> |
ElementSet
Gets the character set associated with the node.
Declaration
public IImmutableDistribution<TElement, TElementSet> ElementSet { get; }
Property Value
Type | Description |
---|---|
IImmutableDistribution<TElement, TElementSet> |
Type
Gets the type of the node.
Declaration
public RegexpTreeNodeType Type { get; }
Property Value
Type | Description |
---|---|
RegexpTreeNodeType |
Methods
AppendToString(StringBuilder)
Returns a string representation of the language described by the node.
Declaration
public bool AppendToString(StringBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
StringBuilder | builder | A string builder. |
Returns
Type | Description |
---|---|
Boolean | False if the string was truncated at the maximum length. |
AppendToString(StringBuilder, RegexpFormattingSettings)
Returns a string representation of the language described by the node.
Declaration
public bool AppendToString(StringBuilder builder, RegexpFormattingSettings formattingSettings)
Parameters
Type | Name | Description |
---|---|---|
StringBuilder | builder | The string builder to append to. |
RegexpFormattingSettings | formattingSettings | The formatting settings used for conversion from an automaton to a string. |
Returns
Type | Description |
---|---|
Boolean | False if the string was truncated. |
Concat(RegexpTreeNode<TElement, TElementSet>, RegexpTreeNode<TElement, TElementSet>)
Creates a node representing the concatenation of the languages described by a given pair of nodes.
Declaration
public static RegexpTreeNode<TElement, TElementSet> Concat(RegexpTreeNode<TElement, TElementSet> node1, RegexpTreeNode<TElement, TElementSet> node2)
Parameters
Type | Name | Description |
---|---|---|
RegexpTreeNode<TElement, TElementSet> | node1 | The first node. |
RegexpTreeNode<TElement, TElementSet> | node2 | The second node. |
Returns
Type | Description |
---|---|
RegexpTreeNode<TElement, TElementSet> | The created node. |
Empty()
Creates a node representing language consisting of an empty string.
Declaration
public static RegexpTreeNode<TElement, TElementSet> Empty()
Returns
Type | Description |
---|---|
RegexpTreeNode<TElement, TElementSet> | The created node. |
FromElementSet(Option<TElementSet>)
Creates a terminal node representing a given set of sequence elements.
Declaration
public static RegexpTreeNode<TElement, TElementSet> FromElementSet(Option<TElementSet> elementSet)
Parameters
Type | Name | Description |
---|---|---|
Option<TElementSet> | elementSet | The distribution over sequence elements. |
Returns
Type | Description |
---|---|
RegexpTreeNode<TElement, TElementSet> | The created node. |
Nothing()
Returns a node representing the empty language.
Declaration
public static RegexpTreeNode<TElement, TElementSet> Nothing()
Returns
Type | Description |
---|---|
RegexpTreeNode<TElement, TElementSet> | A node representing the empty language. |
Or(RegexpTreeNode<TElement, TElementSet>, RegexpTreeNode<TElement, TElementSet>)
Creates a node representing the union of the languages described by a given pair of nodes.
Declaration
public static RegexpTreeNode<TElement, TElementSet> Or(RegexpTreeNode<TElement, TElementSet> node1, RegexpTreeNode<TElement, TElementSet> node2)
Parameters
Type | Name | Description |
---|---|---|
RegexpTreeNode<TElement, TElementSet> | node1 | The first node. |
RegexpTreeNode<TElement, TElementSet> | node2 | The second node. |
Returns
Type | Description |
---|---|
RegexpTreeNode<TElement, TElementSet> | The created node. |
Star(RegexpTreeNode<TElement, TElementSet>)
Creates a node representing the Kleene star of the language described by a given node.
Declaration
public static RegexpTreeNode<TElement, TElementSet> Star(RegexpTreeNode<TElement, TElementSet> node)
Parameters
Type | Name | Description |
---|---|---|
RegexpTreeNode<TElement, TElementSet> | node | The node. |
Returns
Type | Description |
---|---|
RegexpTreeNode<TElement, TElementSet> | The created node. |