Interface Lexicon

All Known Implementing Classes:
CMULexicon, CMUTimeLexicon, LexiconImpl

public interface Lexicon
Provides the phone list for words. A Lexicon is composed of three pieces: an addenda, the compiled form, and the letter to sound rules.
  • The addenda either contains Word instances that are not in the compiled form, or it contains Word instances that replace definitions in the compiled form. The addenda is meant to be relatively small (e.g., 10's of words).
  • The compiled form is meant to hold a large number of words (e.g., 10's of thousands of words) and provide a very efficient means for finding those words.
  • The letter to sound rules will attempt to find a definition for a word not found in either the addenda or compiled form.
  • Method Details

    • getPhones

      String[] getPhones(String word, String partOfSpeech)
      Gets the phone list for a given word. If a phone list cannot be found, null is returned. The partOfSpeech is implementation dependent, but null always matches.
      Parameters:
      word - the word to find
      partOfSpeech - the part of speech or null
      Returns:
      the list of phones for word or null
    • getPhones

      String[] getPhones(String word, String partOfSpeech, boolean useLTS)
      Gets the phone list for a given word. If a phone list cannot be found, null is returned. The partOfSpeech is implementation dependent, but null always matches.
      Parameters:
      word - the word to find
      partOfSpeech - the part of speech or null
      useLTS - whether to use the letter-to-sound rules when the word is not in the lexicon.
      Returns:
      the list of phones for word or null
    • addAddendum

      void addAddendum(String word, String partOfSpeech, String[] phones)
      Adds a word to the addenda. The part of speech is implementation dependent.
      Parameters:
      word - the word to add
      partOfSpeech - the part of speech or null
    • removeAddendum

      void removeAddendum(String word, String partOfSpeech)
      Removes a word from the addenda. Both the part of speech and word must be an exact match.
      Parameters:
      word - the word to add
      partOfSpeech - the part of speech
    • isSyllableBoundary

      boolean isSyllableBoundary(List syllablePhones, String[] wordPhones, int currentWordPhone)
      Determines if the currentWordPhone represents a new syllable boundary.
      Parameters:
      syllablePhones - the phones in the current syllable so far
      wordPhones - the phones for the whole word
      currentWordPhone - the word phone in question
      Returns:
      true if the phone is a new boundary
    • load

      void load() throws IOException
      Loads this lexicon. The loading of a lexicon need not be done in the constructor.
      Throws:
      IOException - if an error occurs while loading
    • isLoaded

      boolean isLoaded()
      Determines if this lexicon is loaded.
      Returns:
      true if the lexicon is loaded