Fido Alpha 3.2

fido.linguistic
Class Discourse

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

public class Discourse
extends java.lang.Object

This class holds the previous sentence structure and nouns in the previous sentence for use with pronoun resolving.

The Discourse holds the following nouns:

Currently, pronoun groups, and the pronouns I and you, are not supported.

Discourse also holds a pool of nouns that previous sentences have accessed. This is a subset of items that the user and the system have talked about. This provides a smaller, more direct set of objects for the system to search through when resolving a noun.

For example: The user enters: I just bought a dog Then, The dog is white. Without the discourse pool, the phrase the dog would attempt to match any instance of dog in the system. With the pool, the first sentence adds a new dog instance to the pool. If this is the only dog the user has mentioned, the system would quickly match the dog to the dog in the previous sentence.

The Discourse also keeps the mood of the previous sentence. This is used by the Fragment Resolver to resolve fragments and questions.

The final piece of information the Discourse module holds is the previous Phrase Structure. This is used by the Ellipsis module to match to the current structure and fill in parts of the sentence that are missing.

See Also:
Ellipsis, FragmentResolver

Field Summary
static int COMMAND
          Value for setMood(int)
static int NO_DISCOURSE
          Value for setMood(int) meaning there was not previous sentence
static int QUESTION
          Value for setMood(int)
 
Constructor Summary
Discourse()
          Creates a new Discourse instance
 
Method Summary
 void addContextPool(int objectId)
          Adds an object id to the context pool.
 java.util.Collection getContextPool(int objectRoot)
          This method returns all of the objects in the ContextPool that are in the subtree with objectRoot as the root.
 int getFemale()
          Returns the objectId for the previous female object.
 int getMale()
          Returns the objectId for the previous male object.
 int getNeuter()
          Returns the objectId for the previous neuter object.
 int getPreviousMood()
          Returns the mood of the previous input.
 Sentence getPreviousStructure()
          Returns the Sentence structure previously saved off.
 java.util.Iterator iterateContextPool()
          Returns a list of objects in the context pool.
 boolean lookupContextPool(int objectId)
          Checks if an object id is in the Context pool.
 void setFemale(int objectId)
          Sets the pronoun antecedent for the previous female object.
 void setMale(int objectId)
          Sets the pronoun antecedent for the previous male object.
 void setNeuter(int objectId)
          Sets the pronoun antecedent for objects not either male or female.
 void setPreviousMood(int mood)
          Sets the mood of the previous input.
 void setPreviousStructure(Sentence structure)
          Saves the Sentence structure for following commands to use ellipsis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_DISCOURSE

public static final int NO_DISCOURSE
Value for setMood(int) meaning there was not previous sentence

See Also:
Constant Field Values

COMMAND

public static final int COMMAND
Value for setMood(int)

See Also:
Constant Field Values

QUESTION

public static final int QUESTION
Value for setMood(int)

See Also:
Constant Field Values
Constructor Detail

Discourse

public Discourse()
Creates a new Discourse instance

Method Detail

iterateContextPool

public java.util.Iterator iterateContextPool()
Returns a list of objects in the context pool.

Returns:
Collection of Integer objects.

addContextPool

public void addContextPool(int objectId)
Adds an object id to the context pool.

Parameters:
objectId - ObjectId to add.

getContextPool

public java.util.Collection getContextPool(int objectRoot)
                                    throws FidoDatabaseException
This method returns all of the objects in the ContextPool that are in the subtree with objectRoot as the root.

Parameters:
objectRoot - ObjectId of the object at the root of the subtree to search.
Returns:
Collection of Integer objects for all objects that match.
FidoDatabaseException

lookupContextPool

public boolean lookupContextPool(int objectId)
Checks if an object id is in the Context pool.

Parameters:
objectId - Object id to lookup.
Returns:
True if the object id is in the Context pool. False otherwise.

setNeuter

public void setNeuter(int objectId)
Sets the pronoun antecedent for objects not either male or female.

Parameters:
objectId - ObjectId to set as the last neuter object

getNeuter

public int getNeuter()
Returns the objectId for the previous neuter object.

Returns:
The integer object id.

setMale

public void setMale(int objectId)
Sets the pronoun antecedent for the previous male object.

Parameters:
objectId - ObjectId to set as the last male object

getMale

public int getMale()
Returns the objectId for the previous male object.

Returns:
The integer object id.

setFemale

public void setFemale(int objectId)
Sets the pronoun antecedent for the previous female object.

Parameters:
objectId - ObjectId to set as the last female object

getFemale

public int getFemale()
Returns the objectId for the previous female object.

Returns:
The integer object id.

setPreviousStructure

public void setPreviousStructure(Sentence structure)
Saves the Sentence structure for following commands to use ellipsis.

See Also:
Ellipsis

getPreviousStructure

public Sentence getPreviousStructure()
Returns the Sentence structure previously saved off.

Returns:
Sentence structure of previous input.
See Also:
Ellipsis

setPreviousMood

public void setPreviousMood(int mood)
Sets the mood of the previous input.

Parameters:
mood - mood of the previous input.

getPreviousMood

public int getPreviousMood()
Returns the mood of the previous input.

Returns:
mood of the previous input.

Fido Alpha 3.2