Class AncoraSpanishHeadRules

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

Class for storing the Ancora Spanish head rules associated with parsing. In this class headrules for noun phrases are specified. The rest of the rules are in opennlp-tools/lang/es/parser/es-head-rules

NOTE: This class has been adapted from opennlp.tools.parser.lang.en.HeadRules

The main change is the constituents search direction in the first for loop.

Note also the change in the return of the GetHead(Parse[], string) method: In the Lang.En.HeadRules class: return constituents[ci].Head; Now: return constituents[ci];

Other changes include removal of deprecated methods.

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

Constructors

AncoraSpanishHeadRules(TextReader)

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

public AncoraSpanishHeadRules(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