class LogicParser(object): (source)
Known subclasses: nltk.sem.drt.DrtParser, nltk.sem.linearlogic.LinearLogicParser
Constructor: LogicParser(type_check)
A lambda calculus expression parser.
| Method | __init__ |
to their types. |
| Method | __repr__ |
Undocumented |
| Method | assert |
Undocumented |
| Method | assert |
Undocumented |
| Method | attempt |
Undocumented |
| Method | attempt_ |
Attempt to make an application expression. The next tokens are a list of arguments in parens, then the argument expression is a function being applied to the arguments. Otherwise, return the argument expression. |
| Method | attempt_ |
Attempt to make a boolean expression. If the next token is a boolean operator, then a BooleanExpression will be returned. Otherwise, the parameter will be returned. |
| Method | attempt_ |
Attempt to make an equality expression. If the next token is an equality operator, then an EqualityExpression will be returned. Otherwise, the parameter will be returned. |
| Method | get |
This method exists to be overridden |
| Method | get_ |
This method serves as a hook for other logic parsers that have different boolean operators |
| Method | get |
Undocumented |
| Method | get_ |
This method serves as a hook for other logic parsers that have different quantifiers |
| Method | handle |
This method is intended to be overridden for logics that use different operators or expressions |
| Method | handle |
Undocumented |
| Method | handle |
Undocumented |
| Method | handle |
Undocumented |
| Method | handle |
Undocumented |
| Method | handle |
Undocumented |
| Method | has |
Undocumented |
| Method | in |
Return TRUE if the given location is within the buffer |
| Method | isvariable |
Undocumented |
| Method | make_ |
Undocumented |
| Method | make_ |
Undocumented |
| Method | make_ |
This method serves as a hook for other logic parsers that have different equality expression classes |
| Method | make_ |
Undocumented |
| Method | make_ |
Undocumented |
| Method | make_ |
Undocumented |
| Method | make_ |
Undocumented |
| Method | parse |
Parse the expression. |
| Method | process |
Split the data into tokens |
| Method | process |
Parse the next complete expression from the stream and return it. |
| Method | process |
Undocumented |
| Method | token |
Get the next waiting token. If a location is given, then return the token at currentIndex+location without advancing currentIndex; setting it gives lookahead/lookback capability. |
| Instance Variable | operator |
Undocumented |
| Instance Variable | quote |
Undocumented |
| Instance Variable | right |
Undocumented |
| Instance Variable | type |
A list of tuples of quote characters. The 4-tuple is comprised of the start character, the end character, the escape character, and a boolean indicating whether the quotes should be included in the result... |
| Instance Variable | _buffer |
Undocumented |
| Instance Variable | _current |
Undocumented |
nltk.sem.drt.DrtParser, nltk.sem.linearlogic.LinearLogicParserto their types.
| Parameters | |
| type | bool should type checking be performed? |
nltk.sem.linearlogic.LinearLogicParserAttempt to make an application expression. The next tokens are a list of arguments in parens, then the argument expression is a function being applied to the arguments. Otherwise, return the argument expression.
Attempt to make a boolean expression. If the next token is a boolean operator, then a BooleanExpression will be returned. Otherwise, the parameter will be returned.
Attempt to make an equality expression. If the next token is an equality operator, then an EqualityExpression will be returned. Otherwise, the parameter will be returned.
nltk.sem.drt.DrtParser, nltk.sem.linearlogic.LinearLogicParserThis method exists to be overridden
nltk.sem.drt.DrtParser, nltk.sem.linearlogic.LinearLogicParserThis method serves as a hook for other logic parsers that have different boolean operators
nltk.sem.drt.DrtParser, nltk.sem.linearlogic.LinearLogicParserThis method is intended to be overridden for logics that use different operators or expressions
nltk.sem.drt.DrtParserThis method serves as a hook for other logic parsers that have different equality expression classes
nltk.sem.boxer.BoxerOutputDrsParserParse the expression.
strings :returns: a parsed Expression
| Parameters | |
| data | str for the input to be parsed |
| signature | dict<str, str> that maps variable names to type |
Get the next waiting token. If a location is given, then return the token at currentIndex+location without advancing currentIndex; setting it gives lookahead/lookback capability.
A list of tuples of quote characters. The 4-tuple is comprised of the start character, the end character, the escape character, and a boolean indicating whether the quotes should be included in the result. Quotes are used to signify that a token should be treated as atomic, ignoring any special characters within the token. The escape character allows the quote end character to be used within the quote. If True, the boolean indicates that the final token should contain the quote and escape characters. This method exists to be overridden