Module lambdacalc
source code
Lambda calculus semantic representations for the Jazz Parser.
Defines a set of base classes for use in defining and handling
semantic interpretations of jazz chord sequences. These take the form of
lambda-expressions containing predicates.
A semantic representation should be created as a Semantics object.
This should be initialised with a LogicalForm object defining the logical
form it represents.
LambdaAbstraction, FunctionApplication and Variable define the basic
lambda expressions.
Author:
Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>
|
|
Semantics
This acts as the root node in the LF's tree structure.
|
|
|
LogicalForm
A semantic element, used to build the semantic interpretations
returned by the parser.
|
|
|
LambdaAbstraction
A type of complex logical form element corresponding to a lambda
abstraction.
|
|
|
Variable
A variable in a semantic expression.
|
|
|
FunctionApplication
A function application in a semantic expression.
|
|
|
Terminal
Base class for any logical forms that are atomic: have no children.
|
|
|
Literal
Represents any literal that is used in a semantic expression.
|
|
|
DummyLogicalForm
A logical form that doesn't really represent anything, but
implements the full interface of LogicalForm.
|
|
|
multi_apply(application,
fun,
arg,
*args)
Given a function application class, uses it to produce the curried
application of multiple arguments. |
source code
|
|
|
|
multi_abstract(abstraction,
arg0,
arg1,
*args)
Given a lambda abstraction class, uses it to produce the nested
abstraction over any number of variables. |
source code
|
|
|
|
|
|
|
next_unused_variable(start_var,
var_list)
Returns an altered version of the start_var to represent a new
variable such that it is not equal to the original value and is not
in the var_list |
source code
|
|
|
|
logger = logging.getLogger("main_logger")
|
|
|
__package__ = 'jazzparser.formalisms.base.semantics'
|
distinguish_variables(sem1,
sem2,
semantics=True)
| source code
|
Utility method. Given two instances of Semantics, check to make sure
they have no common variable names and renames them if there are any.
Modifies the object in situ. The semantics flag indicates that the
arguments are within a Semantics object.
|