Java Code Examples for org.apache.uima.UimaContext#getConfigParameterNames()
The following examples show how to use
org.apache.uima.UimaContext#getConfigParameterNames() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractCasAdapter.java From biomedicus with Apache License 2.0 | 6 votes |
@Override public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); try { guiceInjector = (GuiceInjector) aContext.getResourceObject("guiceInjector"); labelAdapters = guiceInjector.attach().getInstance(LabelAdapters.class); } catch (ResourceAccessException e) { throw new ResourceInitializationException(e); } settingsMap = new HashMap<>(); for (String parameterName : aContext.getConfigParameterNames()) { if (parameterName != null) { settingsMap.put(parameterName, aContext.getConfigParameterValue(parameterName)); } } }
Example 2
Source File: GridSearchConfiguration.java From bluima with Apache License 2.0 | 6 votes |
@Override public void initialize(UimaContext ctx) throws ResourceInitializationException { super.initialize(ctx); // dynamically loading parameters (names = "o1", "o2", ...) checkArgument(newArrayList(ctx.getConfigParameterNames()) .contains("o1"), "there should at least be 'o1'"); List<String> optionsStr = newArrayList(); for (int i = 1; i < ctx.getConfigParameterNames().length; i++) { String param = (String) ctx.getConfigParameterValue("o" + i); optionsStr.add(param); } StaticOption.parseOptions(optionsStr); // from combinaisonIndex, find current option StaticOption.setChoosenOption(combinaisonIndex); StaticOption.print(); }
Example 3
Source File: StaticConfiguration.java From bluima with Apache License 2.0 | 6 votes |
@Override /** dynamically loading parameters (names = "o1", "o2", ...)*/ public void initialize(UimaContext ctx) throws ResourceInitializationException { super.initialize(ctx); checkArgument(ctx.getConfigParameterNames().length > 0, "there should at least be one config parameter set"); List<String> optionsStr = newArrayList(); for (String paramName : ctx.getConfigParameterNames()) { String param = (String) ctx.getConfigParameterValue(paramName); optionsStr.add(param); } StaticOption.parseConfiguration(optionsStr); }
Example 4
Source File: Conll2003ReaderTcBmeow.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
private Object[] getConfigurationParams(UimaContext aContext) { Object[] params = new Object[aContext.getConfigParameterNames().length * 2]; int i = 0; for (String name : aContext.getConfigParameterNames()) { params[2*i] = name; params[2*i+1] = aContext.getConfigParameterValue(name); i++; } return params; }
Example 5
Source File: Conll2003ReaderTc.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
private Object[] getConfigurationParams(UimaContext aContext) { Object[] params = new Object[aContext.getConfigParameterNames().length * 2]; int i = 0; for (String name : aContext.getConfigParameterNames()) { params[2*i] = name; params[2*i+1] = aContext.getConfigParameterValue(name); i++; } return params; }
Example 6
Source File: BaleenScheduler.java From baleen with Apache License 2.0 | 5 votes |
/** * Create a configuration map from a context. * * @param context the context * @return non-empty map of config param name to config param value */ protected static Map<String, String> getConfigParameters(final UimaContext context) { // <String, String> due to limitations of Metadata final Map<String, String> ret = new HashMap<>(); for (final String name : context.getConfigParameterNames()) { ret.put(name, context.getConfigParameterValue(name).toString()); } return ret; }