concepts.language.ccg.syntax.CCGComposedSyntaxType#

class CCGComposedSyntaxType[source]#

Bases: CCGSyntaxType

A composed syntax type (e.g., S/NP).

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.

flatten()

Flatten the recursive definition of a syntax type into a list of lower-level syntax types.

none(rhs)

None composition (composition with a None element).

Attributes

arity

The arity of the syntax type.

is_conj

Whether this element is a conjunction.

is_function

Whether the syntax type is a function type.

is_none

Whether this element is None.

is_value

Whether the syntax type is a value type.

parenthesis_typename

Return the typename with parenthesis.

__floordiv__(other)#

Construct a AB syntax type.

Parameters:

other (CCGSyntaxType)

Return type:

CCGSyntaxType

__init__(main, sub, direction)[source]#

Initialize the composed syntax type.

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

flatten()[source]#

Flatten the recursive definition of a syntax type into a list of lower-level syntax types. For example, the syntax type S/NP will be flattened into [S, NP, (S/NP, RIGHT)].

Returns:

the list of flattened lower-level syntax types.

Return type:

List[CCGSyntaxType | Tuple[CCGSyntaxType, CCGCompositionDirection]]

none(rhs)#

None composition (composition with a None element).

Parameters:

rhs (CCGComposable)

Return type:

CCGComposable

property arity#

The arity of the syntax type. That is, the number of arguments it needs to combine before it becomes a primitive syntax type.

property is_conj: bool#

Whether this element is a conjunction.

property is_function: bool#

Whether the syntax type is a function type. That is, whether it can do function application with another syntax type.

property is_none: bool#

Whether this element is None.

property is_value: bool#

Whether the syntax type is a value type. That is, whether it is a primitive syntax type.

property parenthesis_typename: str#

Return the typename with parenthesis.