|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opencyc.templateparser.TemplateParser
Parses chat text, matching the best of a set of templates and returning an event plus arguments.
Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.
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 | |
static int |
DEFAULT_VERBOSITY
The default verbosity of the solution output. |
protected java.util.ArrayList |
relevantTemplates
the relevant templates |
protected java.util.ArrayList |
templates
the templates |
protected int |
verbosity
Sets verbosity of the constraint solver output. |
Constructor Summary | |
TemplateParser()
Constructs a new TemplateParser object. |
Method Summary | |
protected boolean |
canParseChunkWithoutCapturing(java.util.ArrayList partialInputWords,
java.util.ArrayList templateWords)
Returns true iff the given partial input words be parsed without capturing any variable text, by the given template words. |
protected java.lang.Object[] |
getNextTemplateWords(CycList partialTemplateElements)
Returns an array of three objects given the partialTemplateElements. |
java.util.ArrayList |
getTemplates()
Returns the templates. |
void |
initialize()
Initializes this object. |
protected java.lang.Object[] |
parse(java.util.ArrayList partialInputWords,
CycList partialTemplateElements,
ParseResults parseResults)
Parses the partial input words, placing the results into parseResults, and returning an array of two objects: the first is the new partialInputWords and the second is the new partialTemplateElements. |
ParseResults |
parse(java.lang.String inputText)
Parses the given text string using the first matching template. |
protected java.lang.Object[] |
parseChunkWithCapturing(java.util.ArrayList partialInputWords,
java.util.ArrayList templateWords)
Parses the partial input words, capturing any words before matching the templateWords. |
protected java.lang.Object[] |
parseIntoWords(java.lang.String inputText)
Parses the input words and punctuation from given input text. |
void |
setRelevantTemplates(java.util.ArrayList relevantTemplates)
Sets the relevant templates. |
void |
setVerbosity(int verbosity)
Sets verbosity of the output. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_VERBOSITY
protected int verbosity
protected java.util.ArrayList templates
protected java.util.ArrayList relevantTemplates
Constructor Detail |
public TemplateParser()
Method Detail |
public void initialize()
public ParseResults parse(java.lang.String inputText)
inputText
- the text string to be parsedprotected java.lang.Object[] parse(java.util.ArrayList partialInputWords, CycList partialTemplateElements, ParseResults parseResults)
partialInputWords
- the partial input text stringpartialTemplateElements
- the partial template expressionparseResults
- the parseResults object so farprotected java.lang.Object[] parseIntoWords(java.lang.String inputText)
inputText
- the input textprotected java.lang.Object[] getNextTemplateWords(CycList partialTemplateElements)
partialTemplateElements
- the partial template elementsprotected java.lang.Object[] parseChunkWithCapturing(java.util.ArrayList partialInputWords, java.util.ArrayList templateWords)
partialInputWords
- the partial input text wordstemplateWords
- the template words (up to the end of the template,
or to the next variable in the template)protected boolean canParseChunkWithoutCapturing(java.util.ArrayList partialInputWords, java.util.ArrayList templateWords)
partialInputWords
- the partial input wordstemplateWords
- the template words (up to the end of the
template elements or the next variable)public java.util.ArrayList getTemplates()
public void setRelevantTemplates(java.util.ArrayList relevantTemplates)
relevantTemplates
- the relevant templates for constrained parsingpublic void setVerbosity(int verbosity)
verbosity
- 0 --> quiet ... 9 -> maximum diagnostic input
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |