Fido Alpha 3.2

fido.linguistic
Class WordLookup

java.lang.Object
  |
  +--fido.linguistic.WordLookup

public class WordLookup
extends java.lang.Object

Attempts to find a word string in one of four ways:

  1. WordClassification - Identifies classes of words, such as numbers and dates
  2. Dictionary - List of all words known to the system
  3. Morphology - Looks for prefixes and suffixes to strip off to find the root form of a word. See Morphology for a description on morphology tags.
  4. Unknown Word - Special word in the Dictionary that is used if the word is not found.

See Also:
WordClassificationTable, DictionaryTable, LanguageMorphologyTable

Constructor Summary
WordLookup()
          Creates a new WordLookup instance.
 
Method Summary
 void lookupWord(WordPackage word, java.lang.String language)
          The word string is passed to the WordClassificationTable for a regular expression type matching.
 void lookupWords(java.util.Vector words, java.lang.String language)
          Calls lookupWord() for each word in the parameter word Vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordLookup

public WordLookup()
Creates a new WordLookup instance.

Method Detail

lookupWord

public void lookupWord(WordPackage word,
                       java.lang.String language)
                throws FidoDatabaseException,
                       GrammarParseException,
                       GrammarLinkNotFoundException,
                       LookupWordFailedException
The word string is passed to the WordClassificationTable for a regular expression type matching. This test is for classes of words, such as numbers. Instead of storing every number in the Dictionary, only one number class is stored. If the word string is a number, the number class is used to create the WordSense. If the word is not classified, the word is looked up in the Dictionary. Looking up the word may return mutliple entries from the Dictionary. Every entry in the Dictionary represents a Word Sense.

If no entries are returned from the Dictionary, the word is passed off to the Morphology module. The Morphology module attempts to find a root form of the string the user typed. This includes verb tenses, plurals, and possessives.

If no entries are returned from the Morphology module, the word is assigned UNKNOWN_WORD which has a grammar string. This means the word is not known to the system, but UNKNOWN_WORD contains a grammar string that allows the word to be parsed.

This method is public for the GrammarFrontEnd to be able to lookup one word at a time. For processing commands, the words will be put into a Vector and lookupWords() should be called.

Throws:
FidoDatabaseException - Thrown if there is an error contacting or processing a database request.
GrammarParseException - Thrown if a word in the Dictionary has a grammar string that cannot be parsed.
GrammarLinkNotFoundException - Thrown if a word in the Dictionary has a grammar link type that is not found in the GrammarLinkTypes table
LookupWordFailedException - Thrown if a word cannot be resolved and the special word UNKNOWN_WORD is not found either.
See Also:
WordClassificationTable, DictionaryTable, LanguageMorphologyTable, WordSense, WordPackage

lookupWords

public void lookupWords(java.util.Vector words,
                        java.lang.String language)
                 throws FidoDatabaseException,
                        GrammarParseException,
                        GrammarLinkNotFoundException,
                        LookupWordFailedException
Calls lookupWord() for each word in the parameter word Vector. Each entry in the Vector of WordPackages will be updated with one to many WordSenses. If any word cannot be found, a LookupWordFailException will be thrown.

Parameters:
words - Vector of WordPackages
language - Language of the words
Throws:
FidoDatabaseException - Thrown if there is an error contacting or processing a database request.
GrammarParseException - Thrown if a word in the Dictionary has a grammar string that cannot be parsed.
GrammarLinkNotFoundException - Thrown if a word in the Dictionary has a grammar link type that is not found in the GrammarLinkTypes table
LookupWordFailedException - Thrown if a word cannot be resolved and the special word UNKNOWN_WORD is not found either.
See Also:
DictionaryTable, WordPackage, WordSense, lookupWord(WordPackage, String)

Fido Alpha 3.2