本文整理了Java中org.apache.uima.resource.ResourceManager.getResource
方法的一些代码示例,展示了ResourceManager.getResource
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceManager.getResource
方法的具体详情如下:
包路径:org.apache.uima.resource.ResourceManager
类名称:ResourceManager
方法名:getResource
[英]Gets the instance of the implementation object for a resource that has been registered under the specified name.
[中]获取已在指定名称下注册的资源的实现对象的实例。
代码示例来源:origin: apache/uima-uimaj
/**
* Acquires a Resource object using the ResourceManager.
*
* @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceObject(java.lang.String)
*/
public Object getResourceObject(String aKey) throws ResourceAccessException {
return getResourceManager().getResource(makeQualifiedName(aKey));
}
代码示例来源:origin: apache/uima-uimaj
/**
* @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceObject(java.lang.String,
* java.lang.String[])
*/
public Object getResourceObject(String aKey, String[] aParams) throws ResourceAccessException {
return getResourceManager().getResource(makeQualifiedName(aKey), aParams);
}
代码示例来源:origin: org.apache.uima/ConceptMapper
public static void main(String[] args) throws Exception {
String dictionaryResourceName = DICTIONARY_RESOURCE_NAME;
if (args.length == 2) {
// do nothing
} else if (args.length == 3) {
dictionaryResourceName = args[2];
} else {
usage();
System.exit(17);
}
AnalysisEngineDescription conceptMapperDesc = UIMAFramework.getXMLParser()
.parseAnalysisEngineDescription(new XMLInputSource(args[0]));
AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(conceptMapperDesc);
DictionaryResource_impl dict = (DictionaryResource_impl) ae.getResourceManager().getResource(
dictionaryResourceName);
OutputStream output = new BufferedOutputStream(new FileOutputStream(args[1]));
dict.serializeEntries(output);
output.close();
ae.destroy();
// for some reason JVM won't exit normally,
// probably because CPM threads are alive?
System.exit(0);
}
代码示例来源:origin: org.dkpro.tc/dkpro-tc-api-features
@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(TcFeature feature)
throws ResourceInitializationException, ResourceAccessException
{
// Configure external resource
ExternalResourceDescription desc = feature.getActualValue();
// Configure resource manager
ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
.createResourceManagerConfiguration();
ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
// Instantiate resource manager (internally instantiates resources)
final ResourceManager manager = new ResourceManager_impl();
manager.initializeExternalResources(cfg, "/", null);
T res = (T) manager.getResource("/rootResource");
// Initialize nested resources
UimaContextAdmin ctx = new RootUimaContext_impl()
{
@Override
public ResourceManager getResourceManager()
{
return manager;
};
};
ExternalResourceInitializer.initialize(res, ctx);
// Get resource instance
return res;
}
代码示例来源:origin: org.dkpro.tc/dkpro-tc-api-features
@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(Class<T> aClass, Object... aParam)
throws ResourceInitializationException, ResourceAccessException
{
// Configure external resource
ExternalResourceDescription desc = ExternalResourceFactory
.createExternalResourceDescription(aClass, aParam);
// Configure resource manager
ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
.createResourceManagerConfiguration();
ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
// Instantiate resource manager (internally instantiates resources)
final ResourceManager manager = new ResourceManager_impl();
manager.initializeExternalResources(cfg, "/", null);
T res = (T) manager.getResource("/rootResource");
// Initialize nested resources
UimaContextAdmin ctx = new RootUimaContext_impl()
{
@Override
public ResourceManager getResourceManager()
{
return manager;
};
};
ExternalResourceInitializer.initialize(res, ctx);
// Get resource instance
return res;
}
代码示例来源:origin: dkpro/dkpro-tc
@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(TcFeature feature)
throws ResourceInitializationException, ResourceAccessException
{
// Configure external resource
ExternalResourceDescription desc = feature.getActualValue();
// Configure resource manager
ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
.createResourceManagerConfiguration();
ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
// Instantiate resource manager (internally instantiates resources)
final ResourceManager manager = new ResourceManager_impl();
manager.initializeExternalResources(cfg, "/", null);
T res = (T) manager.getResource("/rootResource");
// Initialize nested resources
UimaContextAdmin ctx = new RootUimaContext_impl()
{
@Override
public ResourceManager getResourceManager()
{
return manager;
};
};
ExternalResourceInitializer.initialize(res, ctx);
// Get resource instance
return res;
}
代码示例来源:origin: dkpro/dkpro-tc
@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(Class<T> aClass, Object... aParam)
throws ResourceInitializationException, ResourceAccessException
{
// Configure external resource
ExternalResourceDescription desc = ExternalResourceFactory
.createExternalResourceDescription(aClass, aParam);
// Configure resource manager
ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
.createResourceManagerConfiguration();
ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
// Instantiate resource manager (internally instantiates resources)
final ResourceManager manager = new ResourceManager_impl();
manager.initializeExternalResources(cfg, "/", null);
T res = (T) manager.getResource("/rootResource");
// Initialize nested resources
UimaContextAdmin ctx = new RootUimaContext_impl()
{
@Override
public ResourceManager getResourceManager()
{
return manager;
};
};
ExternalResourceInitializer.initialize(res, ctx);
// Get resource instance
return res;
}
内容来源于网络,如有侵权,请联系作者删除!