public abstract class AbstractModels<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static Path |
BASE_CLASSPATH |
static String |
JVM_PROPERTY_NAME |
protected org.slf4j.Logger |
LOGGER |
protected ConcurrentHashMap<Language,Semaphore> |
modelLock |
protected Map<Language,T> |
models |
NlpStage |
stage |
protected Pipeline.Type |
type |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractModels(Pipeline.Type type,
NlpStage stage) |
| Modifier and Type | Method and Description |
|---|---|
void |
addResourceToContextClassLoader(Path resourcePath,
ClassLoader loader) |
protected void |
downloadIfNecessary(Language language,
ClassLoader loader) |
T |
get(Language language) |
protected ClassLoader |
getLoader() |
Path |
getModelsBasePath(Language language) |
Path |
getModelsFilesystemPath(Language language) |
protected RemoteFiles |
getRemoteFiles() |
protected abstract String |
getVersion() |
boolean |
isLoaded(Language language) |
protected boolean |
isPresent(Language language,
ClassLoader loader) |
static boolean |
isSync() |
protected abstract T |
loadModelFile(Language language,
ClassLoader loader) |
static void |
syncModels(boolean sync) |
void |
unload(Language language) |
public static final String JVM_PROPERTY_NAME
protected final org.slf4j.Logger LOGGER
protected static final Path BASE_CLASSPATH
protected final ConcurrentHashMap<Language,Semaphore> modelLock
public final NlpStage stage
protected final Pipeline.Type type
protected AbstractModels(Pipeline.Type type, NlpStage stage)
protected abstract T loadModelFile(Language language, ClassLoader loader) throws IOException
IOExceptionprotected abstract String getVersion()
public T get(Language language) throws InterruptedException
InterruptedExceptionpublic void addResourceToContextClassLoader(Path resourcePath, ClassLoader loader)
protected boolean isPresent(Language language, ClassLoader loader)
protected void downloadIfNecessary(Language language, ClassLoader loader)
protected ClassLoader getLoader()
public void unload(Language language) throws InterruptedException
InterruptedExceptionpublic static void syncModels(boolean sync)
public static boolean isSync()
public boolean isLoaded(Language language)
protected RemoteFiles getRemoteFiles()
Copyright © 2020 ICIJ. All rights reserved.