Class HeadRules

Namespace
NOpenNLP.Tools.Parser.Lang.En
Assembly
NOpenNLP.Tools.dll

Class for storing the English head rules associated with parsing.

public class HeadRules : IHeadRules, IGapLabeler, ISerializableArtifact
Inheritance
HeadRules
Implements
Inherited Members

Constructors

HeadRules(TextReader)

Creates a new set of head rules based on the specified reader.

public HeadRules(TextReader rulesReader)

Parameters

rulesReader TextReader

The head rules reader.

Exceptions

IOException

Thrown if the head rules reader can not be read.

Properties

ArtifactSerializerClass

Retrieves the class which can serialize and recreate this artifact.
Note: The serializer class must have a public zero argument constructor or an exception is thrown during model serialization/loading.

public Type ArtifactSerializerClass { get; }

Property Value

Type

the corresponding IArtifactSerializer class.

PunctuationTags

Returns the set of punctuation tags. Attachment decisions for these tags will not be modeled.

public ISet<string> PunctuationTags { get; }

Property Value

ISet<string>

Methods

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetHead(Parse[], string)

Returns the head constituent for the specified constituents of the specified type.

public Parse? GetHead(Parse[] constituents, string type)

Parameters

constituents Parse[]

The constituents which make up a constituent of the specified type.

type string

The type of a constituent which is made up of the specified constituents.

Returns

Parse

The constituent which is the head.

LabelGaps(IList<Constituent>)

Labels the constituents found in the stack with gap labels if appropriate.

public void LabelGaps(IList<Constituent> stack)

Parameters

stack IList<Constituent>

The stack of un-completed constituents.

Serialize(TextWriter)

Writes the head rules to the writer in a format suitable for loading the head rules again with the constructor. The encoding must be taken into account while working with the writer and reader.

After the entries have been written, the writer is flushed. The writer remains open after this method returns.

public void Serialize(TextWriter writer)

Parameters

writer TextWriter

Exceptions

IOException