concepts.language.ccg.semantics.CCGSemantics#
- class CCGSemantics[source]#
Bases:
CCGComposable
CCGSemantics is a wrapper of a semantic form (a functor or a value).
Methods
bapp
(lhs)Backward application composition.
compose
(rhs, composition_type)Compose this element with another element.
coord
(other)Coordination composition.
coord3
(lhs, rhs)Coordination composition with three elements.
fapp
(rhs)Forward application composition.
none
(rhs)None composition (composition with a None element).
Attributes
A set of flags that indicates the type of the semantics.
Whether the semantics is a conjunction.
Whether the semantics is a constant.
Whether the semantics is a function.
Whether the semantics is a function application expression.
Whether the semantics is a lazy value.
Whether the semantics is None.
Whether the semantics is a Python function.
Whether the semantics is a value (either a constant or a function application expression).
The return type of the semantics.
The semantic form.
- __init__(value, *, is_conj=False)[source]#
- Parameters:
value (None | Callable | Function | ConstantExpression | FunctionApplicationExpression | CCGSemanticsLazyValue)
is_conj (bool)
- __new__(**kwargs)#
- bapp(lhs)#
Backward application composition.
- Parameters:
lhs (CCGComposable)
- Return type:
- compose(rhs, composition_type)#
Compose this element with another element. This function will call the corresponding composition function according to the composition type. Note that since the coordination composition has three arguments, this function will return a
CCGCoordinationImmNode
for the first two arguments in coordination composition.- Parameters:
rhs (CCGComposable | CCGCoordinationImmNode) – the right-hand side element.
composition_type (CCGCompositionType) – the composition type.
- Returns:
The composed element.
- Return type:
- coord(other)#
Coordination composition.
- Parameters:
other (CCGComposable | CCGCoordinationImmNode)
- Return type:
- coord3(lhs, rhs)#
Coordination composition with three elements.
- Parameters:
lhs (CCGComposable)
rhs (CCGComposable)
- Return type:
- fapp(rhs)#
Forward application composition.
- Parameters:
rhs (CCGComposable)
- Return type:
- none(rhs)#
None composition (composition with a None element).
- Parameters:
rhs (CCGComposable)
- Return type:
- property arity#
- property hash#
- property is_conj#
Whether the semantics is a conjunction.
- property is_constant#
Whether the semantics is a constant.
- property is_function#
Whether the semantics is a function.
- property is_function_application#
Whether the semantics is a function application expression.
- property is_lazy#
Whether the semantics is a lazy value.
- property is_none#
Whether the semantics is None.
- property is_py_function#
Whether the semantics is a Python function.
- property is_value#
Whether the semantics is a value (either a constant or a function application expression).
- property return_type#
The return type of the semantics. If the semantics is a function or a value, the return type is the type of the function or the value. Otherwise, this function will raise an error.
- property value: Callable | Function | ConstantExpression | FunctionApplicationExpression | CCGSemanticsLazyValue#
The semantic form.