public class TextAnnotationMapDBHandler extends Object implements TextAnnotationCache
TextAnnotationCache interface using MapDB storage.
The keys in the map-based DB are the hash codes of the AbstractTextAnnotation.getTokenizedText().| Constructor and Description |
|---|
TextAnnotationMapDBHandler(String dbFile) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTextAnnotation(String dataset,
TextAnnotation ta) |
void |
close()
MapDB requires the database to be closed at the end of operations.
|
boolean |
contains(TextAnnotation ta)
checks whether ta with corresponding TEXT is in database -- not whether the same
annotations are present
|
IResetableIterator<TextAnnotation> |
getDataset(String dataset) |
TextAnnotation |
getTextAnnotation(TextAnnotation ta) |
boolean |
isCached(String dataset,
String dbFile)
Checks if the dataset is cached in the DB.
|
void |
removeTextAnnotation(TextAnnotation ta) |
void |
updateTextAnnotation(TextAnnotation ta) |
public TextAnnotationMapDBHandler(String dbFile)
public void close()
closeOnJvmShutdown() snippet in the initializer, but this method needs to be called if
multiple instances of the TextAnnotationMapDBHandler are used.public boolean isCached(String dataset, String dbFile)
dataset - The name of the dataset (e.g. "train", "test")dbFile - The name of the MapDB filepublic void addTextAnnotation(String dataset, TextAnnotation ta)
addTextAnnotation in interface TextAnnotationCachepublic void updateTextAnnotation(TextAnnotation ta)
updateTextAnnotation in interface TextAnnotationCachepublic IResetableIterator<TextAnnotation> getDataset(String dataset)
getDataset in interface TextAnnotationCachepublic boolean contains(TextAnnotation ta)
contains in interface TextAnnotationCacheta - public void removeTextAnnotation(TextAnnotation ta)
removeTextAnnotation in interface TextAnnotationCachepublic TextAnnotation getTextAnnotation(TextAnnotation ta)
getTextAnnotation in interface TextAnnotationCacheCopyright © 2017. All rights reserved.