Show / Hide Table of Contents

Class Rule

This class implements a production rule, which is of the form: Left Hand Side -> Right Hand Side Left hand side can be a single nonterminal, right hand side can be a sequence of nonterminals. see class description of Nonterminal for more details about the nonterminal type. (Right hand side with length 0 expands to the empty string, i.e. an epsilon rule)

Inheritance
object
Rule
Implements
IEquatable<Rule>
Inherited Members
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: EarleyParser
Assembly: EarleyParser.dll
Syntax
public class Rule : IEquatable<Rule>

Constructors

| Edit this page View Source

Rule(Rule)

Initializes a new instance of the Rule class as a copy of another rule.

Declaration
public Rule(Rule otherRule)
Parameters
Type Name Description
Rule otherRule

The rule to copy.

| Edit this page View Source

Rule(string, string[])

Initializes a new instance of the Rule class.

Declaration
public Rule(string lhs, string[] rhs)
Parameters
Type Name Description
string lhs

The left-hand side of the rule.

string[] rhs

The right-hand side of the rule.

Properties

| Edit this page View Source

IsLexical

Gets a value indicating whether this rule is a lexical rule.

Declaration
public bool IsLexical { get; set; }
Property Value
Type Description
bool
| Edit this page View Source

LeftHandSide

Gets the left-hand side of the grammar rule.

Declaration
public string LeftHandSide { get; set; }
Property Value
Type Description
string
| Edit this page View Source

RightHandSide

Gets the right-hand side of the grammar rule.

Declaration
public string[] RightHandSide { get; set; }
Property Value
Type Description
string[]

Methods

| Edit this page View Source

Equals(Rule)

Determines whether this rule equals another rule.

Declaration
public bool Equals(Rule otherRule)
Parameters
Type Name Description
Rule otherRule

The rule to compare with.

Returns
Type Description
bool

True if the rules are equal, false otherwise.

| Edit this page View Source

Equals(object)

Determines whether this rule equals another object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

The object to compare with.

Returns
Type Description
bool

True if the objects are equal, false otherwise.

Overrides
object.Equals(object)
| Edit this page View Source

ExamineRuleForLexicalizedTokens()

Examines the rule to determine if it contains lexicalized tokens.

Declaration
public bool ExamineRuleForLexicalizedTokens()
Returns
Type Description
bool
| Edit this page View Source

GetHashCode()

Returns the hash code for this rule.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for the current rule.

Overrides
object.GetHashCode()
| Edit this page View Source

ISPOSAssignmentRule()

Checks if this rule is a part-of-speech assignment rule.

Declaration
public bool ISPOSAssignmentRule()
Returns
Type Description
bool

True if the rule assigns a part of speech to a word.

| Edit this page View Source

ToFormattedStackString()

Returns a formatted string representation of the rule.

Declaration
public string ToFormattedStackString()
Returns
Type Description
string

A string in the format "LHS -> RHS".

| Edit this page View Source

ToString()

Returns a string representation of the rule.

Declaration
public override string ToString()
Returns
Type Description
string

A string in the format "LHS -> RHS".

Overrides
object.ToString()

Implements

IEquatable<T>
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX