本文整理汇总了Java中org.apache.uima.fit.factory.ExternalResourceFactory.createDependencyAndBind方法的典型用法代码示例。如果您正苦于以下问题:Java ExternalResourceFactory.createDependencyAndBind方法的具体用法?Java ExternalResourceFactory.createDependencyAndBind怎么用?Java ExternalResourceFactory.createDependencyAndBind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.uima.fit.factory.ExternalResourceFactory
的用法示例。
在下文中一共展示了ExternalResourceFactory.createDependencyAndBind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChineseSegmenterAE
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
public static AnalysisEngineDescription createChineseSegmenterAE(String annotationType) {
try {
AnalysisEngineDescription ae = AnalysisEngineFactory.createEngineDescription(
ChineseSegmenter.class,
ChineseSegmenter.ANNOTATION_TYPE, annotationType
);
ExternalResourceFactory.createDependencyAndBind(
ae,
ChineseSegmenter.CHINESE_WORD_SEGMENTS,
ChineseSegmentResource.class,
ChineseSegmenterResourceHelper.getChineseWordSegments());
ExternalResourceFactory.createDependencyAndBind(
ae,
ChineseSegmenter.CHINESE_FOREIGN_NAME_SEGMENTS,
ChineseSegmentResource.class,
ChineseSegmenterResourceHelper.getForeignNameSegments());
ExternalResourceFactory.createDependencyAndBind(
ae,
ChineseSegmenter.CHINESE_NUMBER_SEGMENTS,
ChineseSegmentResource.class,
ChineseSegmenterResourceHelper.getNumberSegments());
return ae;
} catch(Exception e) {
throw new RuntimeException(e);
}
}
示例2: getConceptMapper
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
public static AnalysisEngineDescription getConceptMapper(String path,
AnalysisEngineDescription tokenDesc) throws UIMAException,
IOException, SAXException {
String conceptMapper = LEXICA_ROOT + "desc/" + path
+ "ConceptMapper.xml";
checkArgument(new File(conceptMapper).exists(),
"no ConceptMapper file at " + conceptMapper);
String lexicon = LEXICA_ROOT + "resources/" + path + ".xml";
checkArgument(new File(lexicon).exists(), "no lexicon file at "
+ lexicon);
AnalysisEngineDescription aed = (AnalysisEngineDescription) createResourceCreationSpecifier(
conceptMapper, new Object[] { "TokenizerDescriptorPath",
getTokenDescPath(tokenDesc), "Stemmer",
SCharsStemmer.class.getName() });
// Create the external resource dependency for the model and bind it
ExternalResourceFactory.createDependencyAndBind(aed, "DictionaryFile",
DictionaryResource_impl.class, "file:" + lexicon);
return aed;
}
示例3: createMateAEDesc
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
public static AnalysisEngineDescription createMateAEDesc(ResourceConfig resourceConfig, Lang lang, Path mateModelPath) {
try {
AnalysisEngineDescription mateTaggerAE = AnalysisEngineFactory.createEngineDescription(
MateLemmatizerTagger.class
);
String lemmatizerModel = mateModelPath.resolve("mate-lemma-"+lang.getCode()+".model").toString();
String taggerModel = mateModelPath.resolve("mate-pos-"+lang.getCode()+".model").toString();
Preconditions.checkArgument(Files.exists(Paths.get(lemmatizerModel)), "Lemmatizer model does not exist: %s", lemmatizerModel);
Preconditions.checkArgument(Files.exists(Paths.get(taggerModel)), "Tagger model does not exist: %s", taggerModel);
ExternalResourceFactory.createDependencyAndBind(
mateTaggerAE,
MateLemmatizerTagger.LEMMATIZER,
MateLemmatizerModel.class,
lemmatizerModel);
ExternalResourceFactory.createDependencyAndBind(
mateTaggerAE,
MateLemmatizerTagger.TAGGER,
MateTaggerModel.class,
taggerModel);
AnalysisEngineDescription lemmaFixerAE = AnalysisEngineFactory.createEngineDescription(
MateLemmaFixer.class,
MateLemmaFixer.LANGUAGE, lang.getCode()
);
AnalysisEngineDescription normalizerAE = createNormalizerAE(resourceConfig, lang, Tagger.MATE);
return AnalysisEngineFactory.createEngineDescription(
mateTaggerAE,
lemmaFixerAE,
normalizerAE);
} catch (Exception e) {
throw new TermSuiteException(e);
}
}