Class Lexicon

java.lang.Object
org.episteme.social.linguistics.Lexicon
All Implemented Interfaces:
Serializable, Named

public class Lexicon extends Object implements Named, Serializable
Represents a lexicon - a dictionary of lexemes with definitions.

A lexicon maps lexemes (abstract word units) to their definitions for a specific language. * @see Lexicon (Wikipedia)

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Constructor Details

    • Lexicon

      public Lexicon()
      Creates an empty lexicon.
    • Lexicon

      public Lexicon(String name)
      Creates a named lexicon.
      Parameters:
      name - the lexicon name
    • Lexicon

      public Lexicon(String name, Language language)
      Creates a lexicon for a specific language.
      Parameters:
      name - the lexicon name
      language - the language
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface Named
    • setName

      public void setName(String name)
      Sets the lexicon name.
      Parameters:
      name - the name
    • getLanguage

      public Language getLanguage()
      Returns the language.
      Returns:
      the language
    • setLanguage

      public void setLanguage(Language language)
      Sets the language.
      Parameters:
      language - the language
    • put

      public void put(Lexeme lexeme, String definition)
      Adds a lexeme with definition.
      Parameters:
      lexeme - the lexeme
      definition - the meaning
      Throws:
      IllegalArgumentException - if language mismatch
    • put

      public void put(String word, String definition)
      Adds a word with definition.
      Parameters:
      word - the word string
      definition - the meaning
    • get

      public Lexeme get(String word)
      Gets a lexeme by canonical form.
      Parameters:
      word - the word
      Returns:
      the lexeme, or null if not found
    • getDefinition

      public String getDefinition(String word)
      Gets the definition for a word.
      Parameters:
      word - the word
      Returns:
      the definition, or null if not found
    • contains

      public boolean contains(String word)
      Checks if a word is in the lexicon.
      Parameters:
      word - the word
      Returns:
      true if present
    • remove

      public Lexeme remove(String word)
      Removes a lexeme.
      Parameters:
      word - the word
      Returns:
      the removed lexeme, or null
    • getWords

      public Set<String> getWords()
      Returns all words in the lexicon.
      Returns:
      set of word strings
    • getLexemes

      public Collection<Lexeme> getLexemes()
      Returns all lexemes.
      Returns:
      collection of lexemes
    • size

      public int size()
      Returns the number of entries.
      Returns:
      entry count
    • isEmpty

      public boolean isEmpty()
      Checks if the lexicon is empty.
      Returns:
      true if empty
    • clear

      public void clear()
      Clears all entries.
    • toString

      public String toString()
      Overrides:
      toString in class Object