Namespace NOpenNLP.Tools.Util
Package containing utility data structures and algorithms used by multiple other packages.
Namespaces
- NOpenNLP.Tools.Util.Ext
-
Package containing extension loading code.
- NOpenNLP.Tools.Util.Featuregen
-
This package contains classes for generating sequence features.
Classes
- AbstractEventStream<T>
Base class for IObjectStream<T>s which turn samples into training Events.
- BaseToolFactory
Base class for all tool factories.
Extensions of this class should:
- implement an empty constructor (TODO is it necessary?)
- implement a constructor that takes the IArtifactProvider and
calls
BaseToolFactory(Map) - override CreateArtifactMap() and CreateArtifactSerializersMap() methods if necessary.
- Cache<K, V>
Provides fixed size, pre-allocated, least recently used replacement cache.
NOpenNLP: upstream extends java.util.LinkedHashMap and overrides its
removeEldestEntryhook to bound the size. J2N's J2N.Collections.Generic.OrderedDictionary<TKey, TValue> preserves insertion order but has no such hook, so the eviction is performed explicitly on insert.Note that upstream constructs the map in insertion-order mode (not access-order), so the eviction policy is really first-in-first-out; that behavior is preserved here.
- EventTraceStream
Writes each Event read from the underlying stream to a TextWriter before passing it on.
- FilterObjectStream<S, T>
Abstract base class for filtering IObjectStream<T>s.
Filtering streams take an existing stream and convert its output to something else.
- InsufficientTrainingDataException
This exception indicates that the provided training data is insufficient to train the desired model.
- InvalidFormatException
This exception indicates that a resource violates the expected data format.
- MarkableFileInputStreamFactory
A factory that creates NOpenNLP.Tools.Util.MarkableFileInputStream from a FileInfo.
- MutableInt
This is a non-thread safe mutable int.
- ObjectStreamBase<T>
Supplies the IObjectStream<T> members that upstream declares as Java 8 default methods.
- ParagraphStream
Stream filter which merges text lines into paragraphs. The boundary of paragraph is defined by an empty text line. If the last paragraph in the stream is not terminated by an empty line the left over is assumed to be a paragraph.
- PlainTextByLineStream
Reads a plain text file and return each line as a string object.
- ReverseListIterator<T>
An iterator for a list which returns values in the opposite order as the typical list iterator.
- Sequence
Represents a weighted sequence of outcomes.
- Span
Class for storing start and end integer offsets.
- StringList
The StringList is an immutable list of strings.
- Version
The Version class represents the OpenNlp Tools library version.
The version has three parts:
- Major: OpenNlp Tools libraries with a different major version are not interchangeable.
- Minor: OpenNlp Tools libraries with an identical major version, but different minor version may be interchangeable. See release notes for further details.
- Revision: OpenNlp Tools libraries with same major and minor version, but a different revision, are fully interchangeable.
Interfaces
- IBeamSearchContextGenerator<T>
Interface for context generators used with a sequence beam search.
- IInputStreamFactory
Allows repeated reads through a stream for certain types of model building. Use
MockInputStreamFactoryfor default behavior.
- IObjectStream<T>
Reads
Objects from a stream.Design Decision:
This interface provides a means for iterating over the objects in a stream, it does not implement IEnumerator<T> or IEnumerable<T> because:Iterator.next()andIterator.hasNext()are declared as throwing no checked exceptions. Thus the IOExceptions thrown by Read() would have to be wrapped in runtime exceptions, and the compiler would be unable to force users of this code to catch such exceptions.- Implementing an enumerable would mean either silently calling Reset() to guarantee that all items were always seen on each iteration, or documenting that it only iterates over the remaining elements of the IObjectStream<T>. In either case, users not reading the documentation carefully might run into unexpected behavior.
- IResetableIterator<E>
This interface makes an IEnumerator<T> resetable.