concepts.language.neural_ccg.grammar.NeuralCCGGroundingFunction#
- class NeuralCCGGroundingFunction[source]#
Bases:
object
A data structure contains the implementation of a function (for neural CCG semantics).
Methods
bind_constants
(constant)Bind a constant to the function.
Attributes
The function application expression, the function, or a python Callable function representing the semantic form of the function.
The executor for the domain.
The number of arguments to the function.
The types of the constant arguments.
The constant that is bound to the function.
The note for the function.
- __init__(expression, executor, nr_arguments=None, constant_arg_types=None, bound_constant=None, note='<anonymous>')[source]#
Initialize a neural CCG function.
- Parameters:
expression (Callable | ConstantExpression | Function | FunctionApplicationExpression) – the function application expression, the function, or a python Callable function representing the semantic form of the function.
executor (FunctionDomainExecutor) – the executor for the domain.
nr_arguments (int | None) – the number of arguments to the function.
constant_arg_types (Iterable[ConstantType] | None) – the types of the constant arguments. Note that constant-typed arguments always come last.
bound_constant (str | None) – the constant that is bound to the function. During execution, constant-typed arguments will be filled with this constant.
note (Any) – the note for the function. This is used for debugging.
- __new__(**kwargs)#
- bind_constants(constant)[source]#
Bind a constant to the function. This function derives a new function with the same underlying expression.
- Parameters:
constant (str) – the constant to be bound.
- Returns:
the new function with the constant bound.
- Return type:
- bound_constant: str | None#
The constant that is bound to the function. During execution, constant-typed arguments will be filled with this constant.
- constant_arg_types: Tuple[ConstantType]#
The types of the constant arguments. Note that constant-typed arguments always come last.
- executor: FunctionDomainExecutor#
The executor for the domain.
- expression: Callable | Function | FunctionApplicationExpression#
The function application expression, the function, or a python Callable function representing the semantic form of the function.