edu.mit.jwi
Class RAMDictionary.DictionaryData

java.lang.Object
  extended by edu.mit.jwi.RAMDictionary.DictionaryData
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
RAMDictionary

public static class RAMDictionary.DictionaryData
extends java.lang.Object
implements java.io.Serializable

Object that holds all the dictionary data loaded from the Wordnet files.

Since:
JWI 2.2.0
Author:
Mark A. Finlayson
See Also:
Serialized Form

Nested Class Summary
 class RAMDictionary.DictionaryData.WordBuilder
          A utility class that allows us to build word objects
 
Field Summary
protected  java.util.Map<POS,java.util.Map<IExceptionEntryID,IExceptionEntry>> exceptions
           
protected  java.util.Map<POS,java.util.Map<IIndexWordID,IIndexWord>> idxWords
           
protected  java.util.Map<ISenseKey,ISenseEntry> senses
           
protected  java.util.Map<POS,java.util.Map<ISynsetID,ISynset>> synsets
           
protected  IVersion version
           
protected  java.util.Map<ISenseKey,IWord> words
           
 
Constructor Summary
RAMDictionary.DictionaryData()
          Constructs an empty dictionary data object.
 
Method Summary
 void compact()
          Compacts this dictionary data object by resizing the internal maps, and removing redundant objects where possible.
protected
<K,V> java.util.Map<K,V>
compactMap(java.util.Map<K,V> map)
          Compacts a regular map.
 void compactObjects()
          Replaces redundant objects where possible
protected
<K,V> void
compactPOSMap(java.util.Map<POS,java.util.Map<K,V>> map)
          Compacts a part-of-speech map
 void compactSize()
          Resizes the internal data maps to be the exact size to contain their data.
protected  IIndexWord makeIndexWord(IIndexWord old)
          Creates a new index word that replicates the specified index word.
protected
<K,V> java.util.Map<K,V>
makeMap(int initialSize, java.util.Map<K,V> contents)
          Creates the actual sub-maps for the part-of-speech maps.
protected
<K,V> java.util.Map<POS,java.util.Map<K,V>>
makePOSMap()
          This method is used when constructing the dictionary data object.
protected  ISynset makeSynset(ISynset old)
          Creates a new synset object that replaces all the old internal ISynsetID objects with those from the denoted synsets, thus throwing away redundant sysnet ids.
protected  IWord makeWord(ISynset newSynset, ISynset oldSynset, IWord old)
          Creates a new word object that replaces all the old internal IWordID objects with those from the denoted words, thus throwing away redundant word ids.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

protected IVersion version

idxWords

protected java.util.Map<POS,java.util.Map<IIndexWordID,IIndexWord>> idxWords

synsets

protected java.util.Map<POS,java.util.Map<ISynsetID,ISynset>> synsets

exceptions

protected java.util.Map<POS,java.util.Map<IExceptionEntryID,IExceptionEntry>> exceptions

words

protected java.util.Map<ISenseKey,IWord> words

senses

protected java.util.Map<ISenseKey,ISenseEntry> senses
Constructor Detail

RAMDictionary.DictionaryData

public RAMDictionary.DictionaryData()
Constructs an empty dictionary data object.

Since:
JWI 2.2.0
Method Detail

makePOSMap

protected <K,V> java.util.Map<POS,java.util.Map<K,V>> makePOSMap()
This method is used when constructing the dictionary data object. Constructs an map with an empty sub-map for every part of speech. Subclasses may override to change map character

Type Parameters:
K - the type of the keys for the sub-maps
V - the type of the values for the sub-maps
Returns:
a map with an empty sub-map for every part of speech.
Since:
JWI 2.2.0

makeMap

protected <K,V> java.util.Map<K,V> makeMap(int initialSize,
                                           java.util.Map<K,V> contents)
Creates the actual sub-maps for the part-of-speech maps. This particular implementation creates LinkedHashMap maps.

Type Parameters:
K - the type of the keys for the sub-maps
V - the type of the values for the sub-maps
Parameters:
initialSize - the initial size of the map; this parameter is ignored if the contents parameter is non- null.
contents - the items to be inserted in the map, may be null. If non-null, the initialSize parameter is ignored
Returns:
an empty map with either the specified initial size, or contained the specified contents
Throws:
java.lang.IllegalArgumentException - if the initial size is invalid (less than 1) and the specified contents are null
Since:
JWI 2.2.0

compact

public void compact()
Compacts this dictionary data object by resizing the internal maps, and removing redundant objects where possible.

Since:
JWI 2.2.0

compactSize

public void compactSize()
Resizes the internal data maps to be the exact size to contain their data.

Since:
JWI 2.2.0

compactPOSMap

protected <K,V> void compactPOSMap(java.util.Map<POS,java.util.Map<K,V>> map)
Compacts a part-of-speech map

Parameters:
map - the part-of-speech keyed map to be compacted
Since:
JWI 2.2.0

compactMap

protected <K,V> java.util.Map<K,V> compactMap(java.util.Map<K,V> map)
Compacts a regular map.

Parameters:
map - the map to be compacted, may not be null.
Returns:
the new, compacted map
Throws:
java.lang.NullPointerException - if the specified map is null
Since:
JWI 2.2.0

compactObjects

public void compactObjects()
Replaces redundant objects where possible

Since:
JWI 2.2.0

makeSynset

protected ISynset makeSynset(ISynset old)
Creates a new synset object that replaces all the old internal ISynsetID objects with those from the denoted synsets, thus throwing away redundant sysnet ids.

Parameters:
old - the synset to be replicated
Returns:
the new synset, a copy of the first
Throws:
java.lang.NullPointerException - if the specified synset is null
Since:
JWI 2.2.0

makeWord

protected IWord makeWord(ISynset newSynset,
                         ISynset oldSynset,
                         IWord old)
Creates a new word object that replaces all the old internal IWordID objects with those from the denoted words, thus throwing away redundant word ids.

Parameters:
newSynset - the synset for which the word is being made
oldSynset - the old synset from which the word should be made
old - the word to be replicated
Returns:
the new synset, a copy of the first
Throws:
java.lang.NullPointerException - if any argument is null
Since:
JWI 2.2.0

makeIndexWord

protected IIndexWord makeIndexWord(IIndexWord old)
Creates a new index word that replicates the specified index word. The new index word replaces it's internal synset ids with synset ids from the denoted synsets, thus removing redundant ids.

Parameters:
old - the index word to be replicated
Returns:
the new index word object
Throws:
java.lang.NullPointerException - if the specified index word is null
Since:
JWI 2.2.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.