gate.wordnet
Class IndexFileWordNetImpl

java.lang.Object
  |
  +--gate.util.AbstractFeatureBearer
        |
        +--gate.creole.AbstractResource
              |
              +--gate.creole.AbstractLanguageResource
                    |
                    +--gate.wordnet.IndexFileWordNetImpl
All Implemented Interfaces:
FeatureBearer, LanguageResource, NameBearer, Resource, Serializable, WordNet

public class IndexFileWordNetImpl
extends AbstractLanguageResource
implements WordNet

See Also:
Serialized Form

Nested Class Summary
(package private)  class IndexFileWordNetImpl.SynsetIterator
          iterator for synsets - may load synsets when necessary, not all at once
 
Field Summary
private  URL propertyUrl
          JWNL property file
private  net.didion.jwnl.dictionary.Dictionary wnDictionary
          JWNL dictionary
 
Fields inherited from class gate.creole.AbstractLanguageResource
dataStore, lrPersistentId
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Fields inherited from interface gate.wordnet.WordNet
POS_ADJECTIVE, POS_ADVERB, POS_NOUN, POS_VERB
 
Constructor Summary
IndexFileWordNetImpl()
           
 
Method Summary
private  List _lookupWord(String lemma, net.didion.jwnl.data.IndexWord[] jwIndexWords)
          helper method
 DataStore getDataStore()
          Get the data store that this LR lives in.
 net.didion.jwnl.dictionary.Dictionary getJWNLDictionary()
          helper method
 Object getLRPersistenceId()
          Returns the persistence id of this LR, if it has been stored in a datastore.
 LanguageResource getParent()
          Returns the parent LR of this LR.
 URL getPropertyUrl()
           
 Iterator getSynsets(int _pos)
          returns all synsets for specific POS
 Iterator getUniqueBeginners()
          returns all unique beginners
 String getVersion()
          returns the WordNet version
 Resource init()
          Initialise this resource, and return it.
 boolean isModified()
          Returns true of an LR has been modified since the last sync.
 List lookupWord(String lemma)
          returns list of WordSense-s for specific lemma
 List lookupWord(String lemma, int pos)
          returns list of WordSense-s for specific lemma of the specified POS
 void setDataStore(DataStore dataStore)
          Set the data store that this LR lives in.
 void setLRPersistenceId(Object lrID)
          Sets the persistence id of this LR.
 void setParent(LanguageResource parentLR)
          Sets the parent LR of this LR.
 void setPropertyUrl(URL _propertiesUrl)
           
 void sync()
          Save: synchonise the in-memory image of the LR with the persistent image.
 
Methods inherited from class gate.creole.AbstractLanguageResource
cleanup
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getName, getParameterValue, getParameterValue, 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.Resource
cleanup, getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Field Detail

wnDictionary

private net.didion.jwnl.dictionary.Dictionary wnDictionary
JWNL dictionary


propertyUrl

private URL propertyUrl
JWNL property file

Constructor Detail

IndexFileWordNetImpl

public IndexFileWordNetImpl()
Method Detail

init

public Resource init()
              throws ResourceInstantiationException
Initialise this resource, and return it.

Specified by:
init in interface Resource
Overrides:
init in class AbstractResource
ResourceInstantiationException

getJWNLDictionary

public net.didion.jwnl.dictionary.Dictionary getJWNLDictionary()
helper method


setPropertyUrl

public void setPropertyUrl(URL _propertiesUrl)
Specified by:
setPropertyUrl in interface WordNet

getPropertyUrl

public URL getPropertyUrl()
Specified by:
getPropertyUrl in interface WordNet

getVersion

public String getVersion()
returns the WordNet version

Specified by:
getVersion in interface WordNet

getSynsets

public Iterator getSynsets(int _pos)
                    throws WordNetException
returns all synsets for specific POS

Specified by:
getSynsets in interface WordNet
WordNetException

getUniqueBeginners

public Iterator getUniqueBeginners()
returns all unique beginners

Specified by:
getUniqueBeginners in interface WordNet

setParent

public void setParent(LanguageResource parentLR)
               throws PersistenceException,
                      SecurityException
Sets the parent LR of this LR. Only relevant for LRs that support shadowing. Most do not by default.

Specified by:
setParent in interface LanguageResource
Overrides:
setParent in class AbstractLanguageResource
PersistenceException
SecurityException

getParent

public LanguageResource getParent()
                           throws PersistenceException,
                                  SecurityException
Returns the parent LR of this LR. Only relevant for LRs that support shadowing. Most do not by default.

Specified by:
getParent in interface LanguageResource
Overrides:
getParent in class AbstractLanguageResource
PersistenceException
SecurityException

isModified

public boolean isModified()
Returns true of an LR has been modified since the last sync. Always returns false for transient LRs.

Specified by:
isModified in interface LanguageResource
Overrides:
isModified in class AbstractLanguageResource

sync

public void sync()
          throws PersistenceException,
                 SecurityException
Save: synchonise the in-memory image of the LR with the persistent image.

Specified by:
sync in interface LanguageResource
Overrides:
sync in class AbstractLanguageResource
PersistenceException
SecurityException

setLRPersistenceId

public void setLRPersistenceId(Object lrID)
Sets the persistence id of this LR. To be used only in the Factory and DataStore code.

Specified by:
setLRPersistenceId in interface LanguageResource
Overrides:
setLRPersistenceId in class AbstractLanguageResource

getLRPersistenceId

public Object getLRPersistenceId()
Returns the persistence id of this LR, if it has been stored in a datastore. Null otherwise.

Specified by:
getLRPersistenceId in interface LanguageResource
Overrides:
getLRPersistenceId in class AbstractLanguageResource

getDataStore

public DataStore getDataStore()
Get the data store that this LR lives in. Null for transient LRs.

Specified by:
getDataStore in interface LanguageResource
Overrides:
getDataStore in class AbstractLanguageResource

setDataStore

public void setDataStore(DataStore dataStore)
                  throws PersistenceException
Set the data store that this LR lives in.

Specified by:
setDataStore in interface LanguageResource
Overrides:
setDataStore in class AbstractLanguageResource
PersistenceException

lookupWord

public List lookupWord(String lemma)
                throws WordNetException
returns list of WordSense-s for specific lemma

Specified by:
lookupWord in interface WordNet
WordNetException

lookupWord

public List lookupWord(String lemma,
                       int pos)
                throws WordNetException
returns list of WordSense-s for specific lemma of the specified POS

Specified by:
lookupWord in interface WordNet
WordNetException

_lookupWord

private List _lookupWord(String lemma,
                         net.didion.jwnl.data.IndexWord[] jwIndexWords)
                  throws WordNetException
helper method

WordNetException