private void loadMappings() throws AnnotatorConfigurationException { mappingsTable = new HashMap<String, String>(); for (int i = 0; i < mappings.length; i++) { String[] pair = mappings[i].split(";"); if (pair.length != 2) { throw new AnnotatorConfigurationException(); } else { String chunkTag = pair[0]; String classTag = pair[1]; mappingsTable.put(chunkTag, classTag); } } }
private int detectSearchStrategy(String strategyString) throws AnnotatorConfigurationException { if ((strategyString == null) || (strategyString.equals(""))) { return DefaultSearchStrategy; } else if (strategyString.equals(PARAMVALUE_CONTIGUOUSMATCH)) { return ContiguousMatch; } else if (strategyString.equals(PARAMVALUE_SKIPANYMATCH)) { return SkipAnyMatch; } else if (strategyString.equals(PARAMVALUE_SKIPANYMATCHALLOWOVERLAP)) { return SkipAnyMatchAllowOverlap; } else { throw new AnnotatorConfigurationException(); } }
void parseScopeOrder(String[] scopeStrings) throws AnnotatorConfigurationException { scopes.clear(); for (int i = 0; i < scopeStrings.length; i++) { if (scopeStrings[i].equals("LEFT")) { scopes.add(new Integer(LEFT_SCOPE)); } else if (scopeStrings[i].equals("MIDDLE")) { scopes.add(new Integer(MIDDLE_SCOPE)); } else if (scopeStrings[i].equals("RIGHT")) { scopes.add(new Integer(RIGHT_SCOPE)); } else if (scopeStrings[i].equals("ALL")) { scopes.add(new Integer(ALL_SCOPE)); } else { Exception e = new Exception("Invalid scope value: " + scopeStrings[i]); throw new AnnotatorConfigurationException(e); } } iv_logger.info("SCOPE ORDER: " + scopes); }
void parseScopeOrder(String[] scopeStrings) throws AnnotatorConfigurationException { scopes.clear(); for (int i = 0; i < scopeStrings.length; i++) { if (scopeStrings[i].equals("LEFT")) { scopes.add(new Integer(LEFT_SCOPE)); } else if (scopeStrings[i].equals("MIDDLE")) { scopes.add(new Integer(MIDDLE_SCOPE)); } else if (scopeStrings[i].equals("RIGHT")) { scopes.add(new Integer(RIGHT_SCOPE)); } else if (scopeStrings[i].equals("ALL")) { scopes.add(new Integer(ALL_SCOPE)); } else { Exception e = new Exception("Invalid scope value: " + scopeStrings[i]); throw new AnnotatorConfigurationException(e); } } iv_logger.info("SCOPE ORDER: " + scopes); }
/** * load mappings of constituent names */ private void loadMappings() { for (int i = 0; i < mappings.length; i++) { String[] pair = mappings[i].split(";"); if (pair.length < 2) { try { throw new AnnotatorConfigurationException(); } catch (AnnotatorConfigurationException e) { LOGGER.error("[OpenNLP Parser: ]" + e.getMessage()); } } else { String consTag = pair[0]; String casTag = pair[1]; mapTable.put(consTag, casTag); } } }
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); if (indexSenseFile != null && sourceInventory != null) { throw new ResourceInitializationException( new AnnotatorConfigurationException( AnnotatorConfigurationException.MUTUALLY_EXCLUSIVE_PARAMS, new String[] { PARAM_INDEX_SENSE_FILE + ", " + SOURCE_SENSE_INVENTORY_RESOURCE })); } if (indexSenseFile != null) { try { senseMap = getSenseMap(ResourceUtils.resolveLocation( indexSenseFile, this, context)); } catch (Exception e) { throw new ResourceInitializationException(e); } } }
} catch (IOException e) { LOGGER.error("setNegativeList() - specified negative list file cannot be read: " + e.getMessage()); throw new AnnotatorConfigurationException(e);
} else { LOGGER.error("setModel() - descriptor incomplete, no model file specified!"); throw new AnnotatorConfigurationException();
} else { LOGGER.error("setModel() - descriptor incomplete, no model file specified!"); throw new AnnotatorConfigurationException();
public void initialize(UimaContext aContext) throws AnnotatorConfigurationException, AnnotatorInitializationException { conWords = new HashSet<String>(); try { //String conWordsFileName = (String) aContext.getConfigParameterValue("ConWordsFile"); //conWords = readLinesFromFile(FileLocator.locateFile(conWordsFileName.replaceAll(apiMacroHome, ".")).getAbsolutePath()); FileResource fResrc = (FileResource) aContext.getResourceObject("negationContradictionWordsKey"); File conWordsFile = fResrc.getFile(); conWords = readLinesFromFile(conWordsFile.getAbsolutePath()); } catch (Exception ace) { throw new AnnotatorConfigurationException(ace); } }
public void initialize(UimaContext aContext) throws AnnotatorConfigurationException, AnnotatorInitializationException { conWords = new HashSet<String>(); try { //String conWordsFileName = (String) aContext.getConfigParameterValue("ConWordsFile"); //conWords = readLinesFromFile(FileLocator.locateFile(conWordsFileName.replaceAll(apiMacroHome, ".")).getAbsolutePath()); FileResource fResrc = (FileResource) aContext.getResourceObject("negationContradictionWordsKey"); File conWordsFile = fResrc.getFile(); conWords = readLinesFromFile(conWordsFile.getAbsolutePath()); } catch (Exception ace) { throw new AnnotatorConfigurationException(ace); } }
logger.info( "Using lucene index: " + indexDir.getAbsolutePath() ); } catch ( Exception e ) { throw new AnnotatorConfigurationException( e );
} else { LOGGER.error("setEntityTypes() - descriptor incomplete, entity types not specified!"); throw new AnnotatorConfigurationException(); "setEntityTypes() - Could not find entity label \"{}\" from descriptor in the tagger's OutputAlphabet.", entityParts[0]); throw new AnnotatorConfigurationException();
private ModelGeneration get_model() throws AnnotatorConfigurationException { IModelResource modelResource = null; try { modelResource = (IModelResource) getContext().getResourceObject(model_file_param); } catch (Exception e) { throw new AnnotatorConfigurationException(e); } return modelResource.getModel(); }
throw new AnnotatorConfigurationException(); throw new AnnotatorConfigurationException(); throw new AnnotatorConfigurationException(ie);
logger.info( "Using lucene index: " + indexDir.getAbsolutePath() ); } catch ( Exception e ) { throw new AnnotatorConfigurationException( e );