Class Dictionary

Namespace
NOpenNLP.Tools.Dictionary
Assembly
NOpenNLP.Tools.dll

This class is a dictionary.

public class Dictionary : IEnumerable<StringList>, IEnumerable, ISerializableArtifact
Inheritance
Dictionary
Implements
Inherited Members

Constructors

Dictionary()

Initializes an empty Dictionary.

public Dictionary()

Dictionary(bool)

public Dictionary(bool caseSensitive)

Parameters

caseSensitive bool

Dictionary(Stream)

Initializes the Dictionary from an existing dictionary resource.

public Dictionary(Stream @in)

Parameters

in Stream

Stream

Properties

ArtifactSerializerClass

Gets the Serializer Class for Dictionary

public virtual Type ArtifactSerializerClass { get; }

Property Value

Type

DictionarySerializer

Count

Retrieves the number of tokens in the current instance.

public virtual int Count { get; }

Property Value

int

number of tokens

MaxTokenCount

public virtual int MaxTokenCount { get; }

Property Value

int

maximum token count in the dictionary

MinTokenCount

public virtual int MinTokenCount { get; }

Property Value

int

minimum token count in the dictionary

Methods

AsStringSet()

Gets this dictionary as an ISet<T> of string. Only the enumerator, Count and Contains members are implemented.

If this dictionary entries are multi tokens only the first token of the entry will be part of the set.

public virtual ISet<string> AsStringSet()

Returns

ISet<string>

a Set containing the entries of this dictionary

Contains(StringList)

Checks if this dictionary has the given entry.

public virtual bool Contains(StringList tokens)

Parameters

tokens StringList

query

Returns

bool

true if it contains the entry otherwise false

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.

GetEnumerator()

Retrieves an Iterator over all tokens.

public virtual IEnumerator<StringList> GetEnumerator()

Returns

IEnumerator<StringList>

token-IEnumerator<T>

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ParseOneEntryPerLine(TextReader)

Reads a dictionary which has one entry per line. The tokens inside an entry are whitespace delimited.

public static Dictionary ParseOneEntryPerLine(TextReader @in)

Parameters

in TextReader

TextReader

Returns

Dictionary

the parsed dictionary

Exceptions

IOException

Put(StringList)

Adds the tokens to the dictionary as one new entry.

public virtual void Put(StringList tokens)

Parameters

tokens StringList

the new entry

Remove(StringList)

Removes the given tokens form the current instance.

public virtual void Remove(StringList tokens)

Parameters

tokens StringList

filter tokens

Serialize(Stream)

Writes the current instance to the given Stream.

public virtual void Serialize(Stream @out)

Parameters

out Stream

Stream

Exceptions

IOException

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.