本文整理汇总了Java中org.apache.uima.fit.factory.ExternalResourceFactory.bindResource方法的典型用法代码示例。如果您正苦于以下问题:Java ExternalResourceFactory.bindResource方法的具体用法?Java ExternalResourceFactory.bindResource怎么用?Java ExternalResourceFactory.bindResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.uima.fit.factory.ExternalResourceFactory
的用法示例。
在下文中一共展示了ExternalResourceFactory.bindResource方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAE
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
private static AnalysisEngineDescription createAE(boolean allowOverlappingOccurrence, boolean useCache) throws Exception {
AnalysisEngineDescription ae = AnalysisEngineFactory.createEngineDescription(
CountingEngine.class,
TokenRegexAE.PARAM_ALLOW_OVERLAPPING_OCCURRENCES, allowOverlappingOccurrence
);
ExternalResourceDescription rules = ExternalResourceFactory.createExternalResourceDescription(
RegexListResource.class,
FRENCH_MWT_RULES.toUri().toString()
);
ExternalResourceFactory.bindResource(
ae,
RegexListResource.KEY_TOKEN_REGEX_RULES,
rules
);
return ae;
}
示例2: createAE
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
private AnalysisEngine createAE(String automataRule)
throws Exception {
Path templatePath = Paths.get("src", "test", "resources", "template-mwt-rules.regex");
File mwtRulesFile = root.newFile();
String template = TestUtils.readFile(templatePath, Charsets.UTF_8);
String mwtText = template.replace("RULE_PATTERN", automataRule);
TestUtils.writeToFile(mwtRulesFile, Charsets.UTF_8, mwtText);
AnalysisEngineDescription ae = AnalysisEngineFactory.createEngineDescription(RecogEngine.class);
ExternalResourceDescription mwtRulesResources = ExternalResourceFactory.createExternalResourceDescription(
RegexListResource.class,
mwtRulesFile.toURI().toURL().toString()
);
ExternalResourceFactory.bindResource(
ae,
TokenRegexAE.TOKEN_REGEX_RULES,
mwtRulesResources);
AnalysisEngine engine = UIMAFramework.produceAnalysisEngine(ae);
return engine;
}
示例3: createNormalizerAEDesc
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
public static AnalysisEngineDescription createNormalizerAEDesc(ResourceConfig resourceConfig, Lang lang, Tagger tagger) {
AnalysisEngineDescription ae;
try {
ae = AnalysisEngineFactory.createEngineDescription(
Lexer.class,
Lexer.PARAM_TYPE, "fr.univnantes.termsuite.types.WordAnnotation"
);
ExternalResourceDescription segmentBank = ExternalResourceFactory.createExternalResourceDescription(
SegmentBankResource.class,
getResourceURL(resourceConfig, ResourceType.SEGMENT_BANK, lang)
);
ExternalResourceFactory.bindResource(
ae,
SegmentBank.KEY_SEGMENT_BANK,
segmentBank);
return ae;
} catch (Exception e) {
throw new TermSuiteException(e);
}
}
示例4: createWordTokenizerAEDesc
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
public static AnalysisEngineDescription createWordTokenizerAEDesc(ResourceConfig resourceConfig, Lang lang) {
AnalysisEngineDescription ae;
try {
ae = AnalysisEngineFactory.createEngineDescription(
Lexer.class,
Lexer.PARAM_TYPE, "fr.univnantes.termsuite.types.WordAnnotation"
);
ExternalResourceDescription segmentBank = ExternalResourceFactory.createExternalResourceDescription(
SegmentBankResource.class,
getResourceURL(resourceConfig, ResourceType.SEGMENT_BANK, lang)
);
ExternalResourceFactory.bindResource(
ae,
SegmentBank.KEY_SEGMENT_BANK,
segmentBank);
return ae;
} catch (Exception e) {
throw new TermSuiteException(e);
}
}
示例5: createFixedExpressionSpotterAEDesc
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
/**
* Spots fixed expressions in the CAS an creates {@link FixedExpression}
* annotation whenever one is found.
*
* @return
*/
public static AnalysisEngineDescription createFixedExpressionSpotterAEDesc(ResourceConfig resourceConfig, Lang lang) {
try {
AnalysisEngineDescription ae = AnalysisEngineFactory.createEngineDescription(
FixedExpressionSpotter.class,
FixedExpressionSpotter.FIXED_EXPRESSION_MAX_SIZE, 5,
FixedExpressionSpotter.REMOVE_WORD_ANNOTATIONS_FROM_CAS, false,
FixedExpressionSpotter.REMOVE_TERM_OCC_ANNOTATIONS_FROM_CAS, true
);
ExternalResourceDescription fixedExprRes = ExternalResourceFactory.createExternalResourceDescription(
FixedExpressionResource.class,
getResourceURL(resourceConfig, ResourceType.FIXED_EXPRESSIONS, lang));
ExternalResourceFactory.bindResource(
ae,
FixedExpressionResource.FIXED_EXPRESSION_RESOURCE,
fixedExprRes
);
return ae;
} catch (Exception e) {
throw new PreparationPipelineException(e);
}
}
示例6: createSubNormalizerAEDesc
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
private static AnalysisEngineDescription createSubNormalizerAEDesc(String target, URL mappingFile) {
try {
AnalysisEngineDescription ae = AnalysisEngineFactory.createEngineDescription(
Mapper.class,
Mapper.PARAM_SOURCE, "fr.univnantes.termsuite.types.WordAnnotation:tag",
Mapper.PARAM_TARGET, target,
Mapper.PARAM_UPDATE, true
);
ExternalResourceDescription mappingRes = ExternalResourceFactory.createExternalResourceDescription(
MappingResource.class,
mappingFile
);
ExternalResourceFactory.bindResource(
ae,
Mapping.KEY_MAPPING,
mappingRes
);
return ae;
} catch (Exception e) {
throw new PreparationPipelineException(e);
}
}
示例7: makeAE
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
private AnalysisEngine makeAE(boolean removeWordAnnotationFromCas, boolean removeTermOccAnnotationFromCas) throws Exception {
AnalysisEngineDescription aeDesc = AnalysisEngineFactory.createEngineDescription(
FixedExpressionSpotter.class,
FixedExpressionSpotter.FIXED_EXPRESSION_MAX_SIZE, 5,
FixedExpressionSpotter.REMOVE_WORD_ANNOTATIONS_FROM_CAS, removeWordAnnotationFromCas,
FixedExpressionSpotter.REMOVE_TERM_OCC_ANNOTATIONS_FROM_CAS, removeTermOccAnnotationFromCas
);
/*
* The term index resource
*/
ExternalResourceDescription fixedExpressionDesc = ExternalResourceFactory.createExternalResourceDescription(
FixedExpressionResource.FIXED_EXPRESSION_RESOURCE,
FixedExpressionResource.class,
"file:fr/univnantes/termsuite/test/resources/french-fixed-expressions.txt"
);
ExternalResourceFactory.bindResource(aeDesc, fixedExpressionDesc);
AnalysisEngine ae = AnalysisEngineFactory.createEngine(aeDesc);
return ae;
}
示例8: run
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
private void run() throws Exception {
//
CollectionReaderDescription colReaderDesc;
{
TypeSystemDescription tsDesc = TypeSystemDescriptionFactory
.createTypeSystemDescription(
"com.textocat.textokit.commons.Commons-TypeSystem",
TokenizerAPI.TYPESYSTEM_TOKENIZER,
SentenceSplitterAPI.TYPESYSTEM_SENTENCES,
PosTaggerAPI.TYPESYSTEM_POSTAGGER);
//
colReaderDesc = CollectionReaderFactory.createReaderDescription(
XmiCollectionReader.class,
tsDesc,
XmiCollectionReader.PARAM_INPUTDIR, corpusDir.getPath());
}
//
AnalysisEngineDescription dcCheckerDesc = createEngineDescription(
DictionaryComplianceChecker.class,
DictionaryComplianceChecker.PARAM_OUT_FILE, outFile,
DictionaryComplianceChecker.PARAM_TARGET_POS_CATEGORIES, posCategories);
//
ExternalResourceDescription morphDictDesc = getMorphDictionaryAPI()
.getResourceDescriptionForCachedInstance();
ExternalResourceFactory.bindResource(dcCheckerDesc,
DictionaryComplianceChecker.RESOURCE_DICTIONARY, morphDictDesc);
// make AGGREGATE
AnalysisEngineDescription aggregateDesc = createEngineDescription(dcCheckerDesc);
//
SimplePipeline.runPipeline(colReaderDesc, aggregateDesc);
}
示例9: setup
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
@Before
public void setup() throws UIMAException, MalformedURLException {
AnalysisEngineDescription ae = AnalysisEngineFactory.createEngineDescription(RecogEngine.class);
ExternalResourceDescription mwtRulesResources = ExternalResourceFactory.createExternalResourceDescription(
RegexListResource.class,
AutomatonTests.RESOURCES.resolve("regex-files/multiple-type-use-case.regex").toUri().toURL().toString()
);
ExternalResourceFactory.bindResource(
ae,
TokenRegexAE.TOKEN_REGEX_RULES,
mwtRulesResources);
engine = UIMAFramework.produceAnalysisEngine(ae);
setupCas();
}
示例10: createTreeTaggerAEDesc
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
public static AnalysisEngineDescription createTreeTaggerAEDesc(ResourceConfig resourceConfig, Lang lang, Path treeTaggerPath) {
try {
AnalysisEngineDescription treeTaggerAE = AnalysisEngineFactory.createEngineDescription(
TreeTaggerWrapper.class,
TreeTaggerWrapper.PARAM_ANNOTATION_TYPE, "fr.univnantes.termsuite.types.WordAnnotation",
TreeTaggerWrapper.PARAM_TAG_FEATURE, "tag",
TreeTaggerWrapper.PARAM_LEMMA_FEATURE, "lemma",
TreeTaggerWrapper.PARAM_UPDATE_ANNOTATION_FEATURES, true,
TreeTaggerWrapper.PARAM_TT_HOME_DIRECTORY, treeTaggerPath.toString()
);
ExternalResourceDescription ttParam = ExternalResourceFactory.createExternalResourceDescription(
TreeTaggerParameter.class,
getResourceURL(resourceConfig, ResourceType.TREETAGGER_CONFIG, lang, Tagger.TREE_TAGGER)
);
ExternalResourceFactory.bindResource(
treeTaggerAE,
TreeTaggerParameter.KEY_TT_PARAMETER,
ttParam
);
AnalysisEngineDescription lemmaFixerAE = AnalysisEngineFactory.createEngineDescription(
TreeTaggerLemmaFixer.class,
TreeTaggerLemmaFixer.LANGUAGE, lang.getCode()
);
AnalysisEngineDescription normalizerAE = createNormalizerAE(resourceConfig, lang, Tagger.TREE_TAGGER);
return AnalysisEngineFactory.createEngineDescription(
treeTaggerAE,
lemmaFixerAE,
normalizerAE);
} catch (Exception e) {
throw new TermSuiteException(e);
}
}
示例11: createRegexSpotterAEDesc
import org.apache.uima.fit.factory.ExternalResourceFactory; //导入方法依赖的package包/类
public static AnalysisEngineDescription createRegexSpotterAEDesc(ResourceConfig resourceConfig, Lang lang) {
try {
AnalysisEngineDescription ae = AnalysisEngineFactory.createEngineDescription(
RegexSpotter.class,
TokenRegexAE.PARAM_ALLOW_OVERLAPPING_OCCURRENCES, true
);
addParameters(
ae,
RegexSpotter.LOG_OVERLAPPING_RULES, false);
ExternalResourceDescription mwtRules = ExternalResourceFactory.createExternalResourceDescription(
RegexListResource.class,
getResourceURL(resourceConfig, ResourceType.MWT_RULES, lang));
ExternalResourceFactory.bindResource(
ae,
RegexListResource.KEY_TOKEN_REGEX_RULES,
mwtRules
);
if(lang != Lang.ZH) {
ExternalResourceDescription allowedCharsRes = ExternalResourceFactory.createExternalResourceDescription(
CharacterFootprintTermFilter.class,
getResourceURL(resourceConfig, ResourceType.ALLOWED_CHARS, lang));
ExternalResourceFactory.bindResource(
ae,
RegexSpotter.CHARACTER_FOOTPRINT_TERM_FILTER,
allowedCharsRes
);
}
ExternalResourceDescription stopWordsRes = ExternalResourceFactory.createExternalResourceDescription(
DefaultFilterResource.class,
getResourceURL(resourceConfig, ResourceType.STOP_WORDS_FILTER, lang));
ExternalResourceFactory.bindResource(
ae,
RegexSpotter.STOP_WORD_FILTER,
stopWordsRes
);
return ae;
} catch(Exception e) {
throw new TermSuiteException(e);
}
}