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
caseSensitivebool
Dictionary(Stream)
Initializes the Dictionary from an existing dictionary resource.
public Dictionary(Stream @in)
Parameters
Properties
ArtifactSerializerClass
Gets the Serializer Class for Dictionary
public virtual Type ArtifactSerializerClass { get; }
Property Value
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
Contains(StringList)
Checks if this dictionary has the given entry.
public virtual bool Contains(StringList tokens)
Parameters
tokensStringListquery
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
objobjectThe object to compare with the current object.
Returns
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
Returns
- Dictionary
the parsed dictionary
Exceptions
Put(StringList)
Adds the tokens to the dictionary as one new entry.
public virtual void Put(StringList tokens)
Parameters
tokensStringListthe new entry
Remove(StringList)
Removes the given tokens form the current instance.
public virtual void Remove(StringList tokens)
Parameters
tokensStringListfilter tokens
Serialize(Stream)
Writes the current instance to the given Stream.
public virtual void Serialize(Stream @out)
Parameters
Exceptions
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.