Fido Alpha 3.2

fido.frontend
Class GrammarSession

java.lang.Object
  |
  +--fido.frontend.GrammarSession

public class GrammarSession
extends java.lang.Object

This class represents one user connection to the server for testing the link grammar subsystem. The GrammarSession inserts words into a Grammar object, then can return a graphical picture of the current state of the Grammar object.

The Grammar module is designed to allow words to be inserted one at a time. This class takes advantage of this by allowing the user to enter one word at a time and visually see the current valid grammars for the words entered.

To use the graphical grammar tool, select the dictionary table from the main page. Select the action Test Grammar Strings.

See Also:
Grammar

Constructor Summary
GrammarSession()
          Creates a new GrammarSession.
 
Method Summary
 void addWord(java.lang.String word)
          Adds a new word to the grammar.
 void clearWords()
          Clears all words in the Grammar object.
 java.awt.image.BufferedImage drawThreads()
          Creates a Java BufferedImage with an image of current state of the Grammar object.
 java.util.Iterator listWords()
          Returns a list of words currently already inserted into the Grammar object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrammarSession

public GrammarSession()
Creates a new GrammarSession. This object will be passed back and forth between the web browser and server to maintain context.

Method Detail

addWord

public void addWord(java.lang.String word)
             throws FidoDatabaseException,
                    GrammarParseException,
                    GrammarLinkNotFoundException,
                    LookupWordFailedException
Adds a new word to the grammar. The word is passed through the LookupWord module, so morphology, word classification, and the dictionary are all consulted to determine the grammar string. This mimics the normal processing a word would follow.

Parameters:
word - String to add to the Grammar object
Throws:
FidoDatabaseException - Thrown if there is an error contacting or processing a database request.
GrammarParseException - Thrown if the word in the Dictionary has a grammar string that cannot be parsed.
GrammarLinkNotFoundException - Thrown if the word in the Dictionary has a grammar link type that is not found in the GrammarLinkTypes table
LookupWordFailedException - Thrown if the word cannot be resolved and the special word UNKNOWN_WORD is not found either.
See Also:
WordLookup, Grammar.insertWord(WordPackage)

listWords

public java.util.Iterator listWords()
Returns a list of words currently already inserted into the Grammar object. These are the surface forms of the words, which is the string the user entered. This may be different from the the root form in the dictionary. Word Classification or Morhpology may have modified the word to make a match in the Dictionary.

Returns:
An iterator of strings.
See Also:
WordLookup

clearWords

public void clearWords()
Clears all words in the Grammar object.


drawThreads

public java.awt.image.BufferedImage drawThreads()
Creates a Java BufferedImage with an image of current state of the Grammar object.

Returns:
A Java BufferedImage class with an image of the current state of the Grammar object.

Fido Alpha 3.2