本文整理汇总了Java中org.apache.uima.UimaContext.getConfigParameterValue方法的典型用法代码示例。如果您正苦于以下问题:Java UimaContext.getConfigParameterValue方法的具体用法?Java UimaContext.getConfigParameterValue怎么用?Java UimaContext.getConfigParameterValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.uima.UimaContext
的用法示例。
在下文中一共展示了UimaContext.getConfigParameterValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
/**
* Initialize the AnnotationFromFileLoader_AE by loading the annotations from file into a hash.
*/
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
String annotationsFile;
annotationsFile = (String) context.getConfigParameterValue(PARAM_ANNOTATION_FILE);
/* load documentid to annotation map */
try {
System.err.println("Initializing AnnotationFromFileLoader: Loading annotations from: " + annotationsFile);
documentID2AnnotationsMap = TextAnnotationUtil.loadAnnotationsFromFile(new File(annotationsFile),
CharacterEncoding.UTF_8);
} catch (IOException e) {
e.printStackTrace();
}
super.initialize(context);
}
示例2: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
String activeMqUrl = (String) aContext.getConfigParameterValue(PARAM_ACTIVE_MQ_URL);
LOGGER.info("Starting connection to ActiveMQ server: {}", activeMqUrl);
String queueName = (String) aContext.getConfigParameterValue(PARAM_ACTIVE_MQ_QUEUE_NAME);
ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(
activeMqUrl);
try {
connection = activeMQConnectionFactory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue(queueName);
messageProducer = session.createProducer(queue);
} catch (JMSException e) {
throw new ResourceInitializationException(e);
}
}
示例3: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
String mongoServer = (String) aContext.getConfigParameterValue(PARAM_MONGO_SERVER);
int mongoPort = (Integer) aContext.getConfigParameterValue(PARAM_MONGO_PORT);
String mongoDbName = (String) aContext.getConfigParameterValue(PARAM_MONGO_DB_NAME);
try {
mongoClient = new MongoClient(mongoServer, mongoPort);
} catch (UnknownHostException e) {
throw new ResourceInitializationException(e);
}
DB db = mongoClient.getDB(mongoDbName);
gridFS = new GridFS(db);
}
示例4: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
/**
* {@inheritDoc} <p>Initializes the 3 parameters, "sourceViewName", "targetViewName", and
* "deleteOriginalView".</p>
*/
@Override
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
sourceViewName = (String) aContext.getConfigParameterValue(PARAM_SOURCE_VIEW_NAME);
targetViewName = (String) aContext.getConfigParameterValue(PARAM_TARGET_VIEW_NAME);
deleteOriginalView = (Boolean) aContext.getConfigParameterValue(PARAM_DELETE_ORIGINAL_VIEW);
try {
String className = (String) aContext.getConfigParameterValue(PARAM_VIEW_MIGRATOR_CLASS);
viewMigratorClass = Class.forName(className).asSubclass(ViewMigrator.class);
} catch (ClassNotFoundException e) {
throw new ResourceInitializationException(e);
}
}
示例5: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
String qrelFileName = (String)aContext.getConfigParameterValue(PARAM_QREL_FILE);
if (null == qrelFileName) {
throw new ResourceInitializationException(
new Exception("Missing parameter value: '" + PARAM_QREL_FILE + "'"));
}
try {
initOutput(qrelFileName);
} catch (IOException e) {
e.printStackTrace();
throw new ResourceInitializationException(e);
}
}
示例6: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext aContext)
throws ResourceInitializationException {
super.initialize(aContext);
String wnh = (String) aContext.getConfigParameterValue(WORDNET_HOME);
if (wnh == null) {
throw new ResourceInitializationException(
new Exception("Missing parameter : '"
+ WORDNET_HOME + "'"));
}
try {
mWordNet = new WordNetUtil(wnh, true /* let's use lexical name for clarity */);
} catch (IOException e) {
e.printStackTrace();
throw new ResourceInitializationException(e);
}
}
示例7: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
Integer tmpInt = (Integer) aContext.getConfigParameterValue(PARAM_MIN_TOK_QTY);
if (null != tmpInt) mMinTokQty = tmpInt;
Boolean tmpBool = (Boolean) aContext.getConfigParameterValue(PARAM_CHECK_QUALITY);
if (tmpBool != null) mCheckQuality = tmpBool;
tmpBool = (Boolean) aContext.getConfigParameterValue(PARAM_SKIP_ANSWERS);
if (tmpBool != null) mSkipAnswers = tmpBool;
tmpBool = (Boolean) aContext.getConfigParameterValue(PARAM_INCLUDE_NOT_BEST);
if (tmpBool != null) mIncludeNotBest = tmpBool;
tmpBool = (Boolean) aContext.getConfigParameterValue(PARAM_DO_POS_TAGGING);
if (tmpBool != null) mDoPOSTagging = tmpBool;
// quality checker needs POS tags
if (mCheckQuality) mDoPOSTagging = true;
logger.info(String.format("DoPOSTagging=%b MinTokQty=%d CheckQuality=%b SkipAnswers=%b IncludeNotBest=%b"
, mDoPOSTagging, mMinTokQty, mCheckQuality, mSkipAnswers, mIncludeNotBest));
mClearNLPEngine = new BasicEngine(aContext, mDoPOSTagging);
}
示例8: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext context)
throws ResourceInitializationException {
super.initialize(context);
String mentionTypeIn = (String) context.getConfigParameterValue(PARAM_ORIG_MENTION);
mentionTypeInPattern = Pattern.compile(mentionTypeIn);
if (mentionTypeInPattern == null) {
logger.error("MapNameToIDSlot_AE error: pattern \"" + mentionTypeIn + "\" doesn't compile. ");
throw new ResourceInitializationException(new RuntimeException("MapNameToIDSlot_AE error: pattern \"" + mentionTypeIn + "\" doesn't compile. "));
}
mentionTypeOut = (String) context.getConfigParameterValue(PARAM_MENTION_TYPE);
}
示例9: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext ac) throws ResourceInitializationException {
/* read in input parameters, and initialize a list of class mention types to remove */
String[] classMentionTypes = (String[]) ac.getConfigParameterValue(PARAM_CLASS_MENTION_TYPES_TO_REMOVE_LIST);
classMentionTypesToRemove = new ArrayList<String>();
for (String type : classMentionTypes) {
classMentionTypesToRemove.add(type.toLowerCase());
}
logger.info("Initialized ClassMentionRemovalFilter; types to remove: " + classMentionTypesToRemove.toString());
super.initialize(ac);
}
示例10: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext uimaContext,
ProcessingResourceMetaData processingResourceMetaData) {
LOGGER.info("Initializing the xmi reader parameters");
failOnUnknownType = (Boolean) uimaContext
.getConfigParameterValue(PARAM_FAIL_UNKNOWN);
addDocumentId = (Boolean) uimaContext
.getConfigParameterValue(PARAM_ADD_DOCUMENT_ID);
}
示例11: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
String migrationClassName = (String) aContext.getConfigParameterValue("migration");
try {
migration = Class.forName(migrationClassName).asSubclass(TypeSystemMigration.class)
.newInstance();
Preconditions.checkNotNull(migration);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new ResourceInitializationException(e);
}
}
示例12: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
annotationTypes = (String[]) aContext.getConfigParameterValue("annotationTypes");
outputDir = Paths.get((String) aContext.getConfigParameterValue("outputDirectory"));
try {
Files.createDirectories(outputDir);
} catch (IOException e) {
throw new ResourceInitializationException(e);
}
}
示例13: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
/**
* @see AnalysisComponent#initialize(UimaContext)
*/
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
/////////////////////////////////
// DEBUGGING PARAMETER SETTING //
/////////////////////////////////
this.deleteOverlapped = true;
Boolean doDebug = (Boolean) aContext.getConfigParameterValue(PARAM_DEBUG);
Logger.setPrintDetails(doDebug == null ? false : doDebug);
/////////////////////////////////
// HANDLE LOCALE //
/////////////////////////////////
if(requestedLocale == null || requestedLocale.length() == 0) { // if the PARAM_LOCALE setting was left empty,
Locale.setDefault(Locale.UK); // use a default, the ISO8601-adhering UK locale (equivalent to "en_GB")
} else { // otherwise, check if the desired locale exists in the JVM's available locale repertoire
try {
Locale locale = DateCalculator.getLocaleFromString(requestedLocale);
Locale.setDefault(locale); // sets it for the entire JVM session
} catch (LocaleException e) {
Logger.printError("Supplied locale parameter couldn't be resolved to a working locale. Try one of these:");
String localesString = new String();
for(Locale l : Locale.getAvailableLocales()) { // list all available locales
localesString += l.toString()+" ";
}
Logger.printError(localesString);
System.exit(-1);
}
}
//////////////////////////////////
// GET CONFIGURATION PARAMETERS //
//////////////////////////////////
language = Language.getLanguageFromString(requestedLanguage);
// typeToProcess = (String) aContext.getConfigParameterValue(PARAM_TYPE_TO_PROCESS);
// find_dates = (Boolean) aContext.getConfigParameterValue(PARAM_DATE);
// find_times = (Boolean) aContext.getConfigParameterValue(PARAM_TIME);
// find_durations = (Boolean) aContext.getConfigParameterValue(PARAM_DURATION);
// find_sets = (Boolean) aContext.getConfigParameterValue(PARAM_SET);
// find_temponyms = (Boolean) aContext.getConfigParameterValue(PARAM_TEMPONYMS);
// group_gran = (Boolean) aContext.getConfigParameterValue(PARAM_GROUP);
////////////////////////////////////////////////////////////
// READ NORMALIZATION RESOURCES FROM FILES AND STORE THEM //
////////////////////////////////////////////////////////////
NormalizationManager.getInstance(language, find_temponyms);
//////////////////////////////////////////////////////
// READ PATTERN RESOURCES FROM FILES AND STORE THEM //
//////////////////////////////////////////////////////
RePatternManager.getInstance(language, find_temponyms);
///////////////////////////////////////////////////
// READ RULE RESOURCES FROM FILES AND STORE THEM //
///////////////////////////////////////////////////
RuleManager.getInstance(language, find_temponyms);
/////////////////////////////////////////////////////////////////////////////////
// SUBPROCESSOR CONFIGURATION. REGISTER YOUR OWN PROCESSORS HERE FOR EXECUTION //
/////////////////////////////////////////////////////////////////////////////////
procMan.registerProcessor("de.unihd.dbs.uima.annotator.heideltime.processors.HolidayProcessor");
procMan.registerProcessor("de.unihd.dbs.uima.annotator.heideltime.processors.DecadeProcessor");
procMan.initializeAllProcessors(aContext);
/////////////////////////////
// PRINT WHAT WILL BE DONE //
/////////////////////////////
if (find_dates) Logger.printDetail("Getting Dates...");
if (find_times) Logger.printDetail("Getting Times...");
if (find_durations) Logger.printDetail("Getting Durations...");
if (find_sets) Logger.printDetail("Getting Sets...");
if (find_temponyms) Logger.printDetail("Getting Temponyms...");
}
示例14: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext uc) throws ResourceInitializationException {
super.initialize(uc);
int groupVarsCount = 0;
int groupParensCount = 0;
/* read in input parameters */
targetMentionType = (String) uc.getConfigParameterValue(PARAM_TARGET_MENTION);
mentionTypesToConvert = new HashSet<String>(Arrays.asList((String[]) uc
.getConfigParameterValue(PARAM_MENTION_TYPES_TO_CONVERT)));
// check syntax of user=provided parameters; if grouping syntax has been provided in
// either the TargetMention or the MentionTypesToConvert, make sure there is
// parallel syntax in the other var.
if (!checkParameterSyntax(targetMentionType, mentionTypesToConvert)) {
// ResourceInitializationException is all that can get thrown
// out of this method. It has a somewhat clumsy constructor
// that expects an exception. In this case there isn't one,
// so I create it: squarePeg.
Exception squarePeg = new Exception("The number of regular expression elements in the targetMentionType"
+ " parameter (like $1) do NOT match the number of regular expression elements"
+ " (like parens) in at least one of the MentionTypesToConvert param." + "\nTargetMentionType: "
+ targetMentionType + "\nMentionTypesToConvert: " + mentionTypesToConvert.toString());
throw new ResourceInitializationException(squarePeg);
}
/* convert all types to lowercase */
// not sure if this is necessary or not with the addition of regex capability????
for (String type : mentionTypesToConvert) {
type = type.toLowerCase();
}
mentionTypePatterns = new HashSet<Pattern>();
for (String mentionType : mentionTypesToConvert) {
mentionTypePatterns.add(Pattern.compile(mentionType));
}
logger.info("Initialized ClassMentionConverter: " + mentionTypesToConvert + " --> " + targetMentionType);
}
示例15: initialize
import org.apache.uima.UimaContext; //导入方法依赖的package包/类
@Override
public void initialize(UimaContext aContext) throws ResourceInitializationException {
super.initialize(aContext);
LOGGER.info("initializing rtf parser");
String rtfPropertiesDesc = (String) aContext.getConfigParameterValue(PARAM_RTF_PROPERTIES_DESC);
String rtfControlKeywordsDesc = (String) aContext
.getConfigParameterValue(PARAM_RTF_CONTROL_KEYWORDS_DESC);
String rtfCasMappingsDesc = (String) aContext
.getConfigParameterValue(PARAM_RTF_CAS_MAPPINGS_DESC);
casRtfParser = CasRtfParser
.createByLoading(rtfPropertiesDesc, rtfControlKeywordsDesc, rtfCasMappingsDesc);
originalDocumentViewName = (String) aContext
.getConfigParameterValue(PARAM_ORIGINAL_DOCUMENT_VIEW_NAME);
targetViewName = (String) aContext.getConfigParameterValue(PARAM_TARGET_VIEW_NAME);
}