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

arity

flags

A set of flags that indicates the type of the semantics.

hash

is_conj

Whether the semantics is a conjunction.

is_constant

Whether the semantics is a constant.

is_function

Whether the semantics is a function.

is_function_application

Whether the semantics is a function application expression.

is_lazy

Whether the semantics is a lazy value.

is_none

Whether the semantics is None.

is_py_function

Whether the semantics is a Python function.

is_value

Whether the semantics is a value (either a constant or a function application expression).

return_type

The return type of the semantics.

value

The semantic form.

__init__(value, *, is_conj=False)[source]#
Parameters:
__new__(**kwargs)#
bapp(lhs)#

Backward application composition.

Parameters:

lhs (CCGComposable)

Return type:

CCGComposable

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:
Returns:

The composed element.

Return type:

CCGComposable | CCGCoordinationImmNode

coord(other)#

Coordination composition.

Parameters:

other (CCGComposable | CCGCoordinationImmNode)

Return type:

CCGComposable | CCGCoordinationImmNode

coord3(lhs, rhs)#

Coordination composition with three elements.

Parameters:
Return type:

CCGComposable

fapp(rhs)#

Forward application composition.

Parameters:

rhs (CCGComposable)

Return type:

CCGComposable

none(rhs)#

None composition (composition with a None element).

Parameters:

rhs (CCGComposable)

Return type:

CCGComposable

property arity#
property flags: Dict[str, bool]#

A set of flags that indicates the type of the semantics.

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.