E - the type of objects handled in the corpus.public class ListCorpus<E> extends Corpus<ObjectHandler<E>> implements Serializable
ListCorpus implements a corpus based on a list of
training and test cases. Training and testing cases are added to
the corpus with addTrain(Object) and addTest(Object) respectively. The training and test data may
be randomized using permuteCorpus(Random).
| Constructor and Description |
|---|
ListCorpus()
Construct a list-based corpus with no entries.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTest(E e)
Add the specified item to the list of test items.
|
void |
addTrain(E e)
Add the specified item to the list of training items.
|
void |
permuteCorpus(Random random)
Uses the specified random number generator to permute the
training and test cases in the corpus.
|
List<E> |
testCases()
Returns an unmodifiable view of the list of test cases
underlying this corpus.
|
List<E> |
trainCases()
Returns an unmodifiable view of the list of training cases
underlying this corpus.
|
void |
visitTest(ObjectHandler<E> handler)
Visit the testing section of the corpus, sending events to the
specified handler.
|
void |
visitTrain(ObjectHandler<E> handler)
Visit the training section of the corpus, sending events to the
specified handler.
|
visitCorpus, visitCorpuspublic void addTest(E e)
e - Item to add as test case.public void addTrain(E e)
e - Item to add as training case.public void permuteCorpus(Random random)
random - Randomizer for corpus.public List<E> testCases()
public List<E> trainCases()
public void visitTrain(ObjectHandler<E> handler)
CorpusThe implementation does nothing. This method should be overridden by subclasses that contain training data.
visitTrain in class Corpus<ObjectHandler<E>>handler - Handler for training events.public void visitTest(ObjectHandler<E> handler)
CorpusThe implementation does nothing. This method should be overridden by subclasses that contain test data.
visitTest in class Corpus<ObjectHandler<E>>handler - Handler for training events.Copyright © 2016 Alias-i, Inc.. All rights reserved.