org.opencyc.templateparser
Class ParseResults

java.lang.Object
  |
  +--org.opencyc.templateparser.ParseResults

public class ParseResults
extends java.lang.Object

Contains the attributes and behavior of the results of a template parse.

Author:
Stephen L. Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Field Summary
protected  java.util.ArrayList bindings
          Variables and their bound text as an list of string pairs.
protected  java.lang.String inputText
          input text
protected  java.util.ArrayList inputWords
          input words
 boolean isCompleteParse
          Indicates whether the complete input text was parsed.
protected  Performative performative
          Performative from the template if parsed OK, otherwise set to the not-understood performative.
protected  Template template
          template used for the parse
protected  java.lang.String terminalPunctuation
          Input text terminal punctuation, which defaults to none.
 
Constructor Summary
ParseResults(java.lang.String inputText)
          Constructs a new ParseResults object given the text for parsing.
 
Method Summary
 void addBinding(CycVariable templateVariable, java.util.ArrayList textBinding)
          Adds a template variable and its text binding to the list of bindings.
 java.util.ArrayList getBindings()
          Returns the list of bindings.
 java.lang.String getInputText()
          Returns the input text
 java.util.ArrayList getInputWords()
          Returns the input words.
 Performative getPerformative()
          Returns the Performative.
 Template getTemplate()
          Returns the template used for the parse.
 java.lang.String getTerminalPunctuation()
          Returns the terminalPunctuation.
 java.util.ArrayList getTextBinding(CycVariable templateVariable)
          Returns the text binding for the given template variable.
 void setInputWords(java.util.ArrayList inputWords)
          Sets the input words.
 void setPerformative(Performative performative)
          Sets the Performative to the given value.
 void setTemplate(Template template)
          Sets the template used for the parse.
 void setTerminalPunctuation(java.lang.String terminalPunctuation)
          Sets the terminalPunctuation.
 java.lang.String toString()
          Returns the string representation of the ParseResults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inputText

protected java.lang.String inputText
input text

inputWords

protected java.util.ArrayList inputWords
input words

template

protected Template template
template used for the parse

performative

protected Performative performative
Performative from the template if parsed OK, otherwise set to the not-understood performative.

terminalPunctuation

protected java.lang.String terminalPunctuation
Input text terminal punctuation, which defaults to none.

bindings

protected java.util.ArrayList bindings
Variables and their bound text as an list of string pairs. Each element of this list is a object array of two items, the first being the CycVariable and the second being the bound text String.

isCompleteParse

public boolean isCompleteParse
Indicates whether the complete input text was parsed.
Constructor Detail

ParseResults

public ParseResults(java.lang.String inputText)
Constructs a new ParseResults object given the text for parsing.
Parameters:
inputText - the input text for parsing
Method Detail

getInputText

public java.lang.String getInputText()
Returns the input text

setInputWords

public void setInputWords(java.util.ArrayList inputWords)
Sets the input words.
Parameters:
inputWords - the input words

getInputWords

public java.util.ArrayList getInputWords()
Returns the input words.
Returns:
the input words

setTerminalPunctuation

public void setTerminalPunctuation(java.lang.String terminalPunctuation)
Sets the terminalPunctuation.
Parameters:
terminalPunctuation - the last punctuation character in the input text.

getTerminalPunctuation

public java.lang.String getTerminalPunctuation()
Returns the terminalPunctuation.
Returns:
the terminal punctuation character

setTemplate

public void setTemplate(Template template)
Sets the template used for the parse.
Parameters:
template - the template used for the parse

getTemplate

public Template getTemplate()
Returns the template used for the parse.
Parameters:
the - template used for the parse

setPerformative

public void setPerformative(Performative performative)
Sets the Performative to the given value.
Parameters:
performative - the performative

getPerformative

public Performative getPerformative()
Returns the Performative.
Returns:
the Performative

addBinding

public void addBinding(CycVariable templateVariable,
                       java.util.ArrayList textBinding)
Adds a template variable and its text binding to the list of bindings.
Parameters:
templateVariable - the template variable
textBinding - the portion of the input text bound to the given template variable

getBindings

public java.util.ArrayList getBindings()
Returns the list of bindings.
Returns:
the list of bindings

getTextBinding

public java.util.ArrayList getTextBinding(CycVariable templateVariable)
Returns the text binding for the given template variable.
Returns:
the text binding for the given template variable, or null if not found

toString

public java.lang.String toString()
Returns the string representation of the ParseResults
Overrides:
toString in class java.lang.Object
Returns:
the representation of the ParseResults as a String