net.sf.extjwnl.dictionary
Class MapBackedDictionary

java.lang.Object
  extended by net.sf.extjwnl.dictionary.Dictionary
      extended by net.sf.extjwnl.dictionary.MapBackedDictionary

public class MapBackedDictionary
extends Dictionary

A Dictionary backed by Maps. Warning: this has huge memory requirements. Make sure to start the interpreter with a large enough free memory pool to accommodate this.

Author:
John Didion , Aliaksandr Autayeu

Nested Class Summary
static class MapBackedDictionary.IndexWordIterator
           
 
Nested classes/interfaces inherited from class net.sf.extjwnl.dictionary.Dictionary
Dictionary.Version
 
Field Summary
static String MORPH
          MorphologicalProcessor class install parameter.
 
Fields inherited from class net.sf.extjwnl.dictionary.Dictionary
CHECK_LEX_IDS_KEY, maxOffset, params
 
Constructor Summary
MapBackedDictionary(Document doc)
           
 
Method Summary
 void addException(Exc exc)
          Adds exception to the dictionary.
 void addIndexWord(IndexWord indexWord)
          Adds index word to the dictionary.
 void addSynset(Synset synset)
          Adds synset to the dictionary.
 void close()
          Shut down the dictionary
 void delete()
           
 void edit()
          Puts the dictionary into edit mode.
 Exc getException(POS pos, String derivation)
          Lookup derivation in the exceptions file of part-of-speech pos and return an Exc object containing the results.
 Iterator<Exc> getExceptionIterator(POS pos)
          Return an Iterator over all the Exceptions in the database.
 IndexWord getIndexWord(POS pos, String lemma)
          Look up a word in the database.
 Iterator<IndexWord> getIndexWordIterator(POS pos)
          Return an Iterator over all the IndexWords of part-of-speech pos in the database.
 Iterator<IndexWord> getIndexWordIterator(POS pos, String substring)
          Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.
 IndexWord getRandomIndexWord(POS pos)
           
 Synset getSynsetAt(POS pos, long offset)
          Return the Synset at offset offset from the database.
 Iterator<Synset> getSynsetIterator(POS pos)
          Return an Iterator over all the Synsets of part-of-speech pos in the database.
 Map<Object,DictionaryElement> getTable(POS pos, DictionaryFileType fileType)
           
 void removeException(Exc exc)
          Removes the exc from the dictionary.
 void removeIndexWord(IndexWord indexWord)
          Removes indexWord from the dictionary.
 void removeSynset(Synset synset)
          Removes synset from the dictionary.
 void save()
          Saves the dictionary.
 
Methods inherited from class net.sf.extjwnl.dictionary.Dictionary
addElement, createException, createIndexWord, createSynset, getDatabaseBackedInstance, getFileBackedInstance, getInstance, getInstance, getInstance, getMapBackedInstance, getMorphologicalProcessor, getRestoreDictionary, getVersion, isEditable, lookupAllIndexWords, lookupIndexWord, prepareQueryString, removeElement, setInstance, setMorphologicalProcessor, setRestoreDictionary, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MORPH

public static final String MORPH
MorphologicalProcessor class install parameter. The value should be the class of MorphologicalProcessor to use.

See Also:
Constant Field Values
Constructor Detail

MapBackedDictionary

public MapBackedDictionary(Document doc)
                    throws JWNLException
Throws:
JWNLException
Method Detail

delete

public void delete()
            throws JWNLException
Overrides:
delete in class Dictionary
Throws:
JWNLException

getIndexWord

public IndexWord getIndexWord(POS pos,
                              String lemma)
Description copied from class: Dictionary
Look up a word in the database. The search is case-independent, and phrases are separated by spaces ("look up", not "look_up"). Note: this method does not subject lemma to any morphological processing. If you want this, use Dictionary.lookupIndexWord(POS, String).

Specified by:
getIndexWord in class Dictionary
Parameters:
pos - The part-of-speech.
lemma - The orthographic representation of the word.
Returns:
An IndexWord representing the word, or null if no such entry exists.

getIndexWordIterator

public Iterator<IndexWord> getIndexWordIterator(POS pos,
                                                String substring)
Description copied from class: Dictionary
Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.

Specified by:
getIndexWordIterator in class Dictionary
Parameters:
pos - The part-of-speech.
substring - substring
Returns:
An iterator over IndexWords.

getIndexWordIterator

public Iterator<IndexWord> getIndexWordIterator(POS pos)
Description copied from class: Dictionary
Return an Iterator over all the IndexWords of part-of-speech pos in the database.

Specified by:
getIndexWordIterator in class Dictionary
Parameters:
pos - The part-of-speech
Returns:
An iterator over IndexWords

getRandomIndexWord

public IndexWord getRandomIndexWord(POS pos)
                             throws JWNLException
Specified by:
getRandomIndexWord in class Dictionary
Throws:
JWNLException

getSynsetIterator

public Iterator<Synset> getSynsetIterator(POS pos)
Description copied from class: Dictionary
Return an Iterator over all the Synsets of part-of-speech pos in the database.

Specified by:
getSynsetIterator in class Dictionary
Parameters:
pos - The part-of-speech.
Returns:
An iterator over Synsets.

getExceptionIterator

public Iterator<Exc> getExceptionIterator(POS pos)
Description copied from class: Dictionary
Return an Iterator over all the Exceptions in the database.

Specified by:
getExceptionIterator in class Dictionary
Parameters:
pos - the part-of-speech
Returns:
Iterator An iterator over Excs

getSynsetAt

public Synset getSynsetAt(POS pos,
                          long offset)
Description copied from class: Dictionary
Return the Synset at offset offset from the database.

Specified by:
getSynsetAt in class Dictionary
Parameters:
pos - The part-of-speech file to look in
offset - The offset of the synset in the file
Returns:
A synset containing the parsed line from the database

getException

public Exc getException(POS pos,
                        String derivation)
Description copied from class: Dictionary
Lookup derivation in the exceptions file of part-of-speech pos and return an Exc object containing the results.

Specified by:
getException in class Dictionary
Parameters:
pos - the exception file to look in
derivation - the word to look up
Returns:
Exc the Exc object

close

public void close()
Description copied from class: Dictionary
Shut down the dictionary

Specified by:
close in class Dictionary

edit

public void edit()
          throws JWNLException
Description copied from class: Dictionary
Puts the dictionary into edit mode.

Overrides:
edit in class Dictionary
Throws:
JWNLException - JWNLException

save

public void save()
          throws JWNLException
Description copied from class: Dictionary
Saves the dictionary.

Overrides:
save in class Dictionary
Throws:
JWNLException - JWNLException

addSynset

public void addSynset(Synset synset)
               throws JWNLException
Description copied from class: Dictionary
Adds synset to the dictionary.

Overrides:
addSynset in class Dictionary
Parameters:
synset - synset to add
Throws:
JWNLException - JWNLException

removeSynset

public void removeSynset(Synset synset)
                  throws JWNLException
Description copied from class: Dictionary
Removes synset from the dictionary.

Overrides:
removeSynset in class Dictionary
Parameters:
synset - synset to remove
Throws:
JWNLException - JWNLException

addException

public void addException(Exc exc)
                  throws JWNLException
Description copied from class: Dictionary
Adds exception to the dictionary.

Overrides:
addException in class Dictionary
Parameters:
exc - exception to add
Throws:
JWNLException - JWNLException

removeException

public void removeException(Exc exc)
                     throws JWNLException
Description copied from class: Dictionary
Removes the exc from the dictionary.

Overrides:
removeException in class Dictionary
Parameters:
exc - exc to be removed
Throws:
JWNLException - JWNLException

addIndexWord

public void addIndexWord(IndexWord indexWord)
                  throws JWNLException
Description copied from class: Dictionary
Adds index word to the dictionary.

Overrides:
addIndexWord in class Dictionary
Parameters:
indexWord - index word to add
Throws:
JWNLException - JWNLException

removeIndexWord

public void removeIndexWord(IndexWord indexWord)
                     throws JWNLException
Description copied from class: Dictionary
Removes indexWord from the dictionary.

Overrides:
removeIndexWord in class Dictionary
Parameters:
indexWord - index word to remove
Throws:
JWNLException - JWNLException

getTable

public Map<Object,DictionaryElement> getTable(POS pos,
                                              DictionaryFileType fileType)


Copyright © 2011. All Rights Reserved.