gate.creole.gazetteer
Class SharedDefaultGazetteer

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractProcessingResource
              extended by gate.creole.AbstractLanguageAnalyser
                  extended by gate.creole.gazetteer.AbstractGazetteer
                      extended by gate.creole.gazetteer.DefaultGazetteer
                          extended by gate.creole.gazetteer.SharedDefaultGazetteer
All Implemented Interfaces:
ANNIEConstants, CustomDuplication, Gazetteer, Executable, LanguageAnalyser, ProcessingResource, Resource, FeatureBearer, NameBearer, Serializable

@CreoleResource(isPrivate=true,
                name="Sharable Gazettee")
public class SharedDefaultGazetteer
extends DefaultGazetteer

Provides a way to efficiently multi-thread a DefaultGazetteer. The reccommended way to multithread a gate pipeline is to have a seperate instance per thread (or a resource pool). This is not ideal when using large Gazetteers as these can take a long time to initialise and take up a lot of memory. This class provides a way to bootstrap a new gazetteer instance off of an existing gazetteer instance while still maintaining all thread level variables. DefaultGazetteer implements CustomDuplication using this class, so the easiest way to build multiple copies of a DefaultGazetteer PR that share a single FSM is to create one in the usual way and then use Factory.duplicate(Resource) to copy it. NOTE: It is (probably) impossible to use this class from within either the Gaze user interface or from a .gapp application file. You should only use this PR when embedding GATE within another application and initialise it specifically. There is no reason a DefaultGazetteer loaded via a .gapp file cannot be used to bootstrap this PR however.

Author:
Matt Nathan
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class gate.creole.gazetteer.DefaultGazetteer
DefaultGazetteer.CharMap, DefaultGazetteer.Iter
 
Nested classes/interfaces inherited from class gate.creole.AbstractProcessingResource
AbstractProcessingResource.InternalStatusListener, AbstractProcessingResource.IntervalProgressListener
 
Field Summary
protected  DefaultGazetteer bootstrapGazetteer
          The existing DefaultGazetteer instance whose FSM we will share.
static String SDEF_GAZ_BOOTSTRAP_GAZETTEER_PROPERTY_NAME
           
 
Fields inherited from class gate.creole.gazetteer.DefaultGazetteer
DEF_GAZ_ANNOT_SET_PARAMETER_NAME, DEF_GAZ_CASE_SENSITIVE_PARAMETER_NAME, DEF_GAZ_DOCUMENT_PARAMETER_NAME, DEF_GAZ_ENCODING_PARAMETER_NAME, DEF_GAZ_FEATURE_SEPARATOR_PARAMETER_NAME, DEF_GAZ_LISTS_URL_PARAMETER_NAME, DEF_GAZ_LONGEST_MATCH_ONLY_PARAMETER_NAME, fsmStates, gazetteerFeatureSeparator, initialState, listsByNode
 
Fields inherited from class gate.creole.gazetteer.AbstractGazetteer
annotationSetName, caseSensitive, definition, encoding, listeners, listsURL, longestMatchOnly, mappingDefinition, wholeWordsOnly
 
Fields inherited from class gate.creole.AbstractLanguageAnalyser
corpus, document
 
Fields inherited from class gate.creole.AbstractProcessingResource
interrupted
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Fields inherited from interface gate.creole.ANNIEConstants
ANNOTATION_COREF_FEATURE_NAME, DATE_ANNOTATION_TYPE, DATE_POSTED_ANNOTATION_TYPE, DEFAULT_FILE, DOCUMENT_COREF_FEATURE_NAME, JOB_ID_ANNOTATION_TYPE, LOCATION_ANNOTATION_TYPE, LOOKUP_ANNOTATION_TYPE, LOOKUP_CLASS_FEATURE_NAME, LOOKUP_INSTANCE_FEATURE_NAME, LOOKUP_LANGUAGE_FEATURE_NAME, LOOKUP_MAJOR_TYPE_FEATURE_NAME, LOOKUP_MINOR_TYPE_FEATURE_NAME, LOOKUP_ONTOLOGY_FEATURE_NAME, MONEY_ANNOTATION_TYPE, ORGANIZATION_ANNOTATION_TYPE, PERSON_ANNOTATION_TYPE, PERSON_GENDER_FEATURE_NAME, PLUGIN_DIR, PR_NAMES, SENTENCE_ANNOTATION_TYPE, SPACE_TOKEN_ANNOTATION_TYPE, TOKEN_ANNOTATION_TYPE, TOKEN_CATEGORY_FEATURE_NAME, TOKEN_KIND_FEATURE_NAME, TOKEN_LENGTH_FEATURE_NAME, TOKEN_ORTH_FEATURE_NAME, TOKEN_STRING_FEATURE_NAME
 
Constructor Summary
SharedDefaultGazetteer()
           
 
Method Summary
 DefaultGazetteer getBootstrapGazetteer()
           
 Resource init()
          Copy the references to the shareable state (i.e. the FSM) from the existing gazetteer.
 void setBootstrapGazetteer(DefaultGazetteer bootstrapGazetteer)
           
 
Methods inherited from class gate.creole.gazetteer.DefaultGazetteer
add, addLookup, createLookups, duplicate, execute, getFSMgml, getGazetteerFeatureSeparator, isWordInternal, lookup, readList, remove, removeLookup, setGazetteerFeatureSeparator
 
Methods inherited from class gate.creole.gazetteer.AbstractGazetteer
addGazetteerListener, fireGazetteerEvent, getAnnotationSetName, getCaseSensitive, getEncoding, getLinearDefinition, getListsURL, getLongestMatchOnly, getMappingDefinition, getWholeWordsOnly, reInit, setAnnotationSetName, setCaseSensitive, setEncoding, setListsURL, setLongestMatchOnly, setMappingDefinition, setWholeWordsOnly
 
Methods inherited from class gate.creole.AbstractLanguageAnalyser
getCorpus, getDocument, setCorpus, setDocument
 
Methods inherited from class gate.creole.AbstractProcessingResource
addProgressListener, addStatusListener, cleanup, fireProcessFinished, fireProgressChanged, fireStatusChanged, getRuntimeParameterValues, getRuntimeParameterValues, interrupt, isInterrupted, removeProgressListener, removeStatusListener
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, flushBeanInfoCache, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.LanguageAnalyser
getCorpus, getDocument, setCorpus, setDocument
 
Methods inherited from interface gate.Resource
cleanup, getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 
Methods inherited from interface gate.Executable
interrupt, isInterrupted
 

Field Detail

SDEF_GAZ_BOOTSTRAP_GAZETTEER_PROPERTY_NAME

public static final String SDEF_GAZ_BOOTSTRAP_GAZETTEER_PROPERTY_NAME
See Also:
Constant Field Values

bootstrapGazetteer

protected DefaultGazetteer bootstrapGazetteer
The existing DefaultGazetteer instance whose FSM we will share.

Constructor Detail

SharedDefaultGazetteer

public SharedDefaultGazetteer()
Method Detail

init

public Resource init()
              throws ResourceInstantiationException
Copy the references to the shareable state (i.e. the FSM) from the existing gazetteer. Note that this method deliberately does not call super.init() as to do so would cause the lists to be reloaded.

Specified by:
init in interface Resource
Overrides:
init in class DefaultGazetteer
Throws:
ResourceInstantiationException

getBootstrapGazetteer

public DefaultGazetteer getBootstrapGazetteer()

setBootstrapGazetteer

@CreoleParameter(comment="The DefaultGazetteer that is to be used to bootstrap this shared instance")
public void setBootstrapGazetteer(DefaultGazetteer bootstrapGazetteer)