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 TextAnnotationCache
public void updateTextAnnotation(TextAnnotation ta)
updateTextAnnotation
in interface TextAnnotationCache
public IResetableIterator<TextAnnotation> getDataset(String dataset)
getDataset
in interface TextAnnotationCache
public boolean contains(TextAnnotation ta)
contains
in interface TextAnnotationCache
ta
- public void removeTextAnnotation(TextAnnotation ta)
removeTextAnnotation
in interface TextAnnotationCache
public TextAnnotation getTextAnnotation(TextAnnotation ta)
getTextAnnotation
in interface TextAnnotationCache
Copyright © 2017. All rights reserved.