Package com.gengoai.hermes.lexicon
Class LexiconManager
- java.lang.Object
-
- com.gengoai.hermes.lexicon.LexiconManager
-
- All Implemented Interfaces:
Serializable
public final class LexiconManager extends Object implements Serializable
Manages the creation and access to Lexicons- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clear()
Clears all loaded lexicons.static Lexicon
getLexicon(String name)
Gets the lexicon of the given name for the default language as defined inHermes.defaultLanguage()
.static Lexicon
getLexicon(String name, @NonNull Language language)
Gets the lexicon with the given name for the given Languageprotected static Lexicon
loadLexicon(String name, Language language)
static void
register(String name, @NonNull Lexicon lexicon)
Registers a lexicon with a given name for the default language as defined inHermes.defaultLanguage()
.static void
register(String name, @NonNull Language language, @NonNull Lexicon lexicon)
Registers a lexicon with the given name for the given languagestatic void
remove(String name)
Removes the lexicon with the given name for the default language as defined inHermes.defaultLanguage()
.static void
remove(String name, @NonNull Language language)
Removes the lexicon with the given name for the given languageprotected static LexiconSpecification
safeParse(String spec)
-
-
-
Method Detail
-
clear
public static void clear()
Clears all loaded lexicons.
-
getLexicon
public static Lexicon getLexicon(String name, @NonNull @NonNull Language language)
Gets the lexicon with the given name for the given Language- Parameters:
name
- the name of the lexiconlanguage
- the language of the lexicon- Returns:
- the lexicon
-
getLexicon
public static Lexicon getLexicon(String name)
Gets the lexicon of the given name for the default language as defined inHermes.defaultLanguage()
.- Parameters:
name
- the name of the lexicon- Returns:
- the lexicon
-
register
public static void register(String name, @NonNull @NonNull Lexicon lexicon)
Registers a lexicon with a given name for the default language as defined inHermes.defaultLanguage()
.- Parameters:
name
- the namelexicon
- the lexicon
-
register
public static void register(String name, @NonNull @NonNull Language language, @NonNull @NonNull Lexicon lexicon)
Registers a lexicon with the given name for the given language- Parameters:
name
- the namelanguage
- the languagelexicon
- the lexicon
-
remove
public static void remove(String name)
Removes the lexicon with the given name for the default language as defined inHermes.defaultLanguage()
.- Parameters:
name
- the name
-
remove
public static void remove(String name, @NonNull @NonNull Language language)
Removes the lexicon with the given name for the given language- Parameters:
name
- the namelanguage
- the language
-
safeParse
protected static LexiconSpecification safeParse(String spec)
-
-