standup.lexicon
Class Dictionary

java.lang.Object
  extended by standup.lexicon.Dictionary

public class Dictionary
extends Object

A class that has various static methods for obtaining Lexemes, WordForms and Concepts.

The methods in this class return instantiations that are obtained from serialized hashtables found under /standup/resources/serialized.

Author:
Ruli Manurung

Field Summary
private static Hashtable<String,Concept> concepts
           
private static Hashtable<WordSequence,Set<String>> indexSpellingToWordFormIDs
           
private static Hashtable<String,Set<String>> indexWordFormIDstoLexemeIDs
           
private static Hashtable<String,Lexeme> lexemes
           
private static Dictionary me
           
private static String serializedConceptsFile
           
private static String serializedDir
           
private static String serializedIndexSpellingToWordFormIDsFile
           
private static String serializedIndexWordFormIDToLexemeIDsFile
           
private static String serializedLexemesFile
           
private static String serializedWordFormsFile
           
private static Hashtable<String,WordForm> wordforms
           
 
Constructor Summary
Dictionary()
           
 
Method Summary
static LexemeSet convertLexemeIDSetToLexemeSet(Set<String> lexemeIDs)
          Returns a LexemeSet of Lexemes whose IDs are contained within the given Set<String>.
static Set<WordForm> convertWordFormIDSetToWordFormSet(Set<String> wordFormIDs)
          Returns a Set<WordForm> of WordForms whose IDs are contained within the given Set<String>.
static Collection<Concept> getAllConcepts()
          Returns a collection of all known Concepts.
static LexemeSet getAllLexemes()
          Returns a collection of all known Lexemes.
static Collection<WordForm> getAllWordForms()
          Returns a collection of all known WordForms.
static Concept getConcept(String id)
          Returns an instance of the Concept with the given ID, or null if one was not found.
static Lexeme getLexeme(String id)
          Returns an instance of the Lexeme with the given ID, or null if one was not found.
static LexemeSet getSpelledLexemes(WordForm wf)
          Returns all Lexemes whose form is the same as the given WordForm.
static LexemeSet getSpelledLexemes(WordSequence ws)
          Returns all Lexemes with the given spelling.
static Set<WordForm> getSpelledWordForms(WordSequence ws)
          Returns all WordForms with the given spelling.
static WordForm getWordForm(String id)
          Returns an instance of the WordForm with the given ID, or null if one was not found.
static void loadConcepts()
          Loads the serialized hashtable of Concepts.
static void loadIndexSpellingToWordFormIDs()
          Loads the serialized index of spelling to WordForm IDs.
static void loadIndexWordFormIDsToLexemeIDs()
          Loads the serialized index of WordForm IDs to Lexeme IDs.
static void loadLexemes()
          Loads the serialized hashtable of Lexemes.
static void loadWordForms()
          Loads the serialized hashtable of WordForms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

me

private static Dictionary me

wordforms

private static Hashtable<String,WordForm> wordforms

concepts

private static Hashtable<String,Concept> concepts

lexemes

private static Hashtable<String,Lexeme> lexemes

indexSpellingToWordFormIDs

private static Hashtable<WordSequence,Set<String>> indexSpellingToWordFormIDs

indexWordFormIDstoLexemeIDs

private static Hashtable<String,Set<String>> indexWordFormIDstoLexemeIDs

serializedDir

private static final String serializedDir
See Also:
Constant Field Values

serializedWordFormsFile

private static final String serializedWordFormsFile
See Also:
Constant Field Values

serializedLexemesFile

private static final String serializedLexemesFile
See Also:
Constant Field Values

serializedConceptsFile

private static final String serializedConceptsFile
See Also:
Constant Field Values

serializedIndexSpellingToWordFormIDsFile

private static final String serializedIndexSpellingToWordFormIDsFile
See Also:
Constant Field Values

serializedIndexWordFormIDToLexemeIDsFile

private static final String serializedIndexWordFormIDToLexemeIDsFile
See Also:
Constant Field Values
Constructor Detail

Dictionary

public Dictionary()
Method Detail

loadLexemes

public static void loadLexemes()
Loads the serialized hashtable of Lexemes.


loadWordForms

public static void loadWordForms()
Loads the serialized hashtable of WordForms.


loadConcepts

public static void loadConcepts()
Loads the serialized hashtable of Concepts.


loadIndexSpellingToWordFormIDs

public static void loadIndexSpellingToWordFormIDs()
Loads the serialized index of spelling to WordForm IDs.


loadIndexWordFormIDsToLexemeIDs

public static void loadIndexWordFormIDsToLexemeIDs()
Loads the serialized index of WordForm IDs to Lexeme IDs.


getLexeme

public static Lexeme getLexeme(String id)
Returns an instance of the Lexeme with the given ID, or null if one was not found.

Parameters:
id -
Returns:

getWordForm

public static WordForm getWordForm(String id)
Returns an instance of the WordForm with the given ID, or null if one was not found.

Parameters:
id -
Returns:

getConcept

public static Concept getConcept(String id)
Returns an instance of the Concept with the given ID, or null if one was not found.

Parameters:
id -
Returns:

getAllLexemes

public static LexemeSet getAllLexemes()
Returns a collection of all known Lexemes.

Returns:

getAllWordForms

public static Collection<WordForm> getAllWordForms()
Returns a collection of all known WordForms.

Returns:

getAllConcepts

public static Collection<Concept> getAllConcepts()
Returns a collection of all known Concepts.

Returns:

convertWordFormIDSetToWordFormSet

public static Set<WordForm> convertWordFormIDSetToWordFormSet(Set<String> wordFormIDs)
Returns a Set<WordForm> of WordForms whose IDs are contained within the given Set<String>.

Parameters:
wordFormIDs -
Returns:

convertLexemeIDSetToLexemeSet

public static LexemeSet convertLexemeIDSetToLexemeSet(Set<String> lexemeIDs)
Returns a LexemeSet of Lexemes whose IDs are contained within the given Set<String>.

Parameters:
wordFormIDs -
Returns:

getSpelledWordForms

public static Set<WordForm> getSpelledWordForms(WordSequence ws)
Returns all WordForms with the given spelling.

Parameters:
ws - the required spelt form
Returns:
a Set of all WordForms with the given spelling, or null if ws is null.

getSpelledLexemes

public static LexemeSet getSpelledLexemes(WordForm wf)
Returns all Lexemes whose form is the same as the given WordForm.

Parameters:
wf -
Returns:
a LexemeSet of all Lexemes whose WordForm is wf, or null if wf is null.

getSpelledLexemes

public static LexemeSet getSpelledLexemes(WordSequence ws)
Returns all Lexemes with the given spelling.

Parameters:
ws - the required spelt form
Returns:
a LexemeSet of all Lexemes with the given spelling, or null if ws is null.