Package org.icij.datashare.text.nlp
Class AbstractModels<T>
- java.lang.Object
-
- org.icij.datashare.text.nlp.AbstractModels<T>
-
public abstract class AbstractModels<T> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static PathBASE_CLASSPATHstatic StringJVM_PROPERTY_NAMEprotected org.slf4j.LoggerLOGGERprotected ConcurrentHashMap<Language,Semaphore>modelLockprotected Map<Language,T>modelsNlpStagestageprotected Pipeline.Typetype
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractModels(Pipeline.Type type, NlpStage stage)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddResourceToContextClassLoader(Path resourcePath)protected voiddownloadIfNecessary(Language language)Tget(Language language)PathgetModelsBasePath(Language language)PathgetModelsFilesystemPath(Language language)protected RemoteFilesgetRemoteFiles()protected abstract StringgetVersion()booleanisLoaded(Language language)protected booleanisPresent(Language language)static booleanisSync()protected abstract TloadModelFile(Language language)static voidsyncModels(boolean sync)voidunload(Language language)
-
-
-
Field Detail
-
JVM_PROPERTY_NAME
public static final String JVM_PROPERTY_NAME
- See Also:
- Constant Field Values
-
LOGGER
protected final org.slf4j.Logger LOGGER
-
BASE_CLASSPATH
protected static final Path BASE_CLASSPATH
-
modelLock
protected final ConcurrentHashMap<Language,Semaphore> modelLock
-
stage
public final NlpStage stage
-
type
protected final Pipeline.Type type
-
-
Constructor Detail
-
AbstractModels
protected AbstractModels(Pipeline.Type type, NlpStage stage)
-
-
Method Detail
-
loadModelFile
protected abstract T loadModelFile(Language language) throws IOException
- Throws:
IOException
-
getVersion
protected abstract String getVersion()
-
get
public T get(Language language) throws InterruptedException
- Throws:
InterruptedException
-
addResourceToContextClassLoader
public void addResourceToContextClassLoader(Path resourcePath)
-
isPresent
protected boolean isPresent(Language language)
-
downloadIfNecessary
protected void downloadIfNecessary(Language language)
-
unload
public void unload(Language language) throws InterruptedException
- Throws:
InterruptedException
-
syncModels
public static void syncModels(boolean sync)
-
isSync
public static boolean isSync()
-
isLoaded
public boolean isLoaded(Language language)
-
getRemoteFiles
protected RemoteFiles getRemoteFiles()
-
-