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) |
protected void |
downloadIfNecessary(Language language) |
T |
get(Language language) |
Path |
getModelsBasePath(Language language) |
Path |
getModelsFilesystemPath(Language language) |
protected RemoteFiles |
getRemoteFiles() |
protected abstract String |
getVersion() |
boolean |
isLoaded(Language language) |
protected boolean |
isPresent(Language language) |
static boolean |
isSync() |
protected abstract T |
loadModelFile(Language language) |
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) throws IOException
IOExceptionprotected abstract String getVersion()
public T get(Language language) throws InterruptedException
InterruptedExceptionpublic void addResourceToContextClassLoader(Path resourcePath)
protected boolean isPresent(Language language)
protected void downloadIfNecessary(Language language)
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–2022 ICIJ. All rights reserved.