Class Constituent

java.lang.Object
  |
  +--Constituent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LexItem, Phrase

public abstract class Constituent
extends java.lang.Object
implements java.io.Serializable

Holds a constituent, any linguistically coherent section of a sentence. Anything which has a syntactic category is a constituent.

See Also:
Serialized Form

Field Summary
protected  int beginPos
           
protected  int endPos
           
protected  boolean held
           
protected static java.lang.String NO_PROLOG
           
protected  java.lang.String prologName
           
protected  Role role
           
protected static java.lang.String WILDCARD
           
 
Constructor Summary
Constituent(int begin, int end, Role newRole, java.lang.String newProlog)
          Creates a constituent with beginning and ending points.
 
Method Summary
 int beginning()
          Finds the beginning of this constituent.
abstract  java.util.LinkedList beginningsList()
          Get a list backed by the beginnings list.
protected  boolean checkHeld(PrologEngine engine)
          Checks if the constituent is held by querying prolog.
 int end()
          Finds the end of this constituent.
abstract  java.lang.String getText()
          Return a string of the 'guts' of this constituent.
 boolean held()
          Determine if this constituent is held in a special list for raising.
 boolean inCat(java.lang.String cat)
          Checks whether this constituent is in some syntactic category.
abstract  java.lang.String interpretation()
          Interpret this constituent.
 int length()
          Finds the length of this constituent, being (end-beginning).
 java.lang.String prologName()
          Return a prolog name for this constituent.
 java.lang.String prologName(boolean info)
          Return a prolog name for this constituent, tagged with more info to prevent mistakes.
 java.lang.String prologStatements()
          Get the prolog statements that apply to this constituent item.
 java.lang.String syntax()
          Get the syntax of this constituent.
 java.lang.String toString()
          Return a string of this constituent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

beginPos

protected int beginPos

endPos

protected int endPos

role

protected Role role

prologName

protected java.lang.String prologName

held

protected boolean held

WILDCARD

protected static final java.lang.String WILDCARD
See Also:
Constant Field Values

NO_PROLOG

protected static final java.lang.String NO_PROLOG
See Also:
Constant Field Values
Constructor Detail

Constituent

public Constituent(int begin,
                   int end,
                   Role newRole,
                   java.lang.String newProlog)
Creates a constituent with beginning and ending points. These are words number indices, where 0 is the first word. Also check if this constituent should be held.

Parameters:
begin - the beginning.
end - the end.
newRole - the new role.
newProlog - the new prolog name.
Method Detail

beginning

public int beginning()
Finds the beginning of this constituent.

Returns:
the beginning of this constituent.

end

public int end()
Finds the end of this constituent.

Returns:
the end of this constituent.

length

public int length()
Finds the length of this constituent, being (end-beginning).

Returns:
the length.

held

public boolean held()
Determine if this constituent is held in a special list for raising.

Returns:
true if the constituent can raise.

toString

public java.lang.String toString()
Return a string of this constituent.

Overrides:
toString in class java.lang.Object
Returns:
the string.

getText

public abstract java.lang.String getText()
Return a string of the 'guts' of this constituent.

Returns:
the words and constituents of this constituent.

prologName

public java.lang.String prologName(boolean info)
Return a prolog name for this constituent, tagged with more info to prevent mistakes. This name should be unique, and contain lexical characters and numbers. It is used to refer to this constituent in the database.

Parameters:
info - whether we need more info.
Returns:
the prolog name.

prologName

public java.lang.String prologName()
Return a prolog name for this constituent. This name should be unique, and contain lexical characters and numbers. It is used to refer to this constituent in the database.

Returns:
the prolog name.

prologStatements

public java.lang.String prologStatements()
Get the prolog statements that apply to this constituent item. These are the 'axioms' of our knowledge base. They require the item to replace the wildcard in the original form with the (implementation-dependent) canonical prolog name to prevent ambiguity.


syntax

public java.lang.String syntax()
Get the syntax of this constituent.

Returns:
the syntax.

inCat

public boolean inCat(java.lang.String cat)
Checks whether this constituent is in some syntactic category.

Parameters:
cat - the category.

beginningsList

public abstract java.util.LinkedList beginningsList()
Get a list backed by the beginnings list.

Returns:
a list of Integers.

interpretation

public abstract java.lang.String interpretation()
Interpret this constituent.

Returns:
the interpretation in prolog of this constituent.

checkHeld

protected boolean checkHeld(PrologEngine engine)
Checks if the constituent is held by querying prolog.

Parameters:
engine - the prolog engine.
Returns:
true if the hold predicate defined in the class header is true.