@Override public boolean add(String singleItem, Lookup lookup) { addLookup(singleItem,lookup); return true; }
/** * Use a {@link SharedDefaultGazetteer} to duplicate this gazetteer * by sharing the internal FSM rather than re-loading the lists. */ @Override public Resource duplicate(Factory.DuplicationContext ctx) throws ResourceInstantiationException { return Factory.createResource(SharedDefaultGazetteer.class.getName(), Utils.featureMap( SharedDefaultGazetteer.SDEF_GAZ_BOOTSTRAP_GAZETTEER_PROPERTY_NAME, this), Factory.duplicate(this.getFeatures(), ctx), this.getName()); }
fireStatusChanged("Performing look-up in " + document.getName() + "..."); String content = document.getContent().toString(); int length = content.length(); createLookups(lastMatchingState, matchedRegionStart, matchedRegionEnd, annotationSet); lastMatchingState = null; || ((matchedRegionStart == 0 || !isWordInternal(content.charAt(matchedRegionStart - 1))) && (charIdx + 1 >= content.length() || !isWordInternal(content.charAt(charIdx + 1))) createLookups(lastMatchingState, matchedRegionStart, matchedRegionEnd, annotationSet); createLookups(lastMatchingState, matchedRegionStart, matchedRegionEnd, annotationSet); lastMatchingState = null; fireProgressChanged((100 * charIdx )/ length ); oldCharIdx = charIdx; if(isInterrupted()) throw new ExecutionInterruptedException( "The execution of the " + getName() + " gazetteer has been abruptly interrupted!"); createLookups(lastMatchingState, matchedRegionStart,
params.put(DefaultGazetteer.DEF_GAZ_DOCUMENT_PARAMETER_NAME, document); params.put(DefaultGazetteer.DEF_GAZ_ANNOT_SET_PARAMETER_NAME, inputASName); gazetteer.setParameterValues(params); gazetteer.addProgressListener(pListener); gazetteer.addStatusListener(sListener); gazetteer.execute(); gazetteer.setDocument(null); gazetteer.removeProgressListener(pListener); gazetteer.removeStatusListener(sListener);
while (inodes.hasNext()) { node = inodes.next(); fireStatusChanged("Reading " + node.toString()); fireProgressChanged(++nodeIdx * 100 / linesCnt); readList(node,true); fireProcessFinished(); return this;
if(add)addLookup(entry, lookup); else removeLookup(entry, lookup);
/** * Copy the references to the shareable state (i.e. the FSM) from the * existing gazetteer. Note that this method <i>deliberately</i> does * not call <code>super.init()</code> as to do so would cause the * lists to be reloaded. */ @Override public Resource init() throws ResourceInstantiationException { if(bootstrapGazetteer == null) { throw new ResourceInstantiationException( "No gazetteer provided to bootstrap this gazetteer creation!"); } this.annotationSetName = bootstrapGazetteer.annotationSetName; this.caseSensitive = bootstrapGazetteer.caseSensitive; this.definition = bootstrapGazetteer.definition; this.encoding = bootstrapGazetteer.encoding; this.fsmStates = bootstrapGazetteer.fsmStates; this.gazetteerFeatureSeparator = bootstrapGazetteer.gazetteerFeatureSeparator; this.initialState = bootstrapGazetteer.initialState; this.listsByNode = bootstrapGazetteer.listsByNode; this.listsURL = bootstrapGazetteer.listsURL; this.longestMatchOnly = bootstrapGazetteer.longestMatchOnly; this.mappingDefinition = bootstrapGazetteer.mappingDefinition; this.wholeWordsOnly = bootstrapGazetteer.wholeWordsOnly; this.getFeatures().putAll(bootstrapGazetteer.getFeatures()); return this; }