Class ChunkSample

Namespace
NOpenNLP.Tools.Chunker
Assembly
NOpenNLP.Tools.dll

Class for holding chunks for a single unit of text.

public class ChunkSample
Inheritance
ChunkSample
Inherited Members

Constructors

ChunkSample(IList<string>, IList<string>, IList<string>)

Initializes the current instance.

public ChunkSample(IList<string> sentence, IList<string> tags, IList<string> preds)

Parameters

sentence IList<string>

training sentence

tags IList<string>

POS Tags for the sentence

preds IList<string>

Chunk tags in B-* I-* notation

ChunkSample(string[], string[], string[])

Initializes the current instance.

public ChunkSample(string[] sentence, string[] tags, string[] preds)

Parameters

sentence string[]

training sentence

tags string[]

POS Tags for the sentence

preds string[]

Chunk tags in B-* I-* notation

Properties

PhrasesAsSpanList

Gets the phrases as an array of spans

public virtual Span[] PhrasesAsSpanList { get; }

Property Value

Span[]

Remarks

NOpenNLP: This was getPhrasesAsSpanList() in Java. Swapped names with the static method below for .NET consistency.

Preds

Gets the Chunk tags in B-* I-* notation

public virtual string[] Preds { get; }

Property Value

string[]

Sentence

Gets the training sentence

public virtual string[] Sentence { get; }

Property Value

string[]

Tags

Gets the POS Tags for the sentence

public virtual string[] Tags { get; }

Property Value

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.

GetPhrasesAsSpanList(string[], string[], string[])

Static method to create arrays of spans of phrases

public static Span[] GetPhrasesAsSpanList(string[] aSentence, string[] aTags, string[] aPreds)

Parameters

aSentence string[]

training sentence

aTags string[]

POS Tags for the sentence

aPreds string[]

Chunk tags in B-* I-* notation

Returns

Span[]

the phrases as an array of spans

Remarks

NOpenNLP: This was phrasesAsSpanList() in Java. Swapped names with the property above for .NET consistency.

NicePrint()

Creates a nice to read string for the phrases formatted as following:

[NP Rockwell_NNP ] [VP said_VBD ] [NP the_DT agreement_NN ] [VP calls_VBZ ] [SBAR for_IN ]
[NP it_PRP ] [VP to_TO supply_VB ] [NP 200_CD additional_JJ so-called_JJ shipsets_NNS ]
[PP for_IN ] [NP the_DT planes_NNS ] ._.
public virtual string NicePrint()

Returns

string

a nice to read string representation of the chunk phases

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.