concepts.language.ccg.composition.CCGCompositionSystem#
- class CCGCompositionSystem[source]#
Bases:
object
The CCG composition system. It keeps track of the rules that can be used for composition.
Methods
Format the summary of the composition system.
Make the CCG composition system that allows function application and coordination (i.e., categorial grammar).
Make the default CCG composition system.
Make the CCG composition system that only allows function application.
Print the summary of the composition system.
try_compose
(lhs, rhs)Try to compose two elements.
Attributes
- __init__(name, weights)[source]#
Initialize the CCG composition system.
- Parameters:
name (str) – the name of the composition system.
weights (Dict[CCGCompositionType, float]) – the weights of the composition types, which should be a dictionary mapping from
CCGCompositionType
to float.
- __new__(**kwargs)#
- classmethod make_categorial_grammar()[source]#
Make the CCG composition system that allows function application and coordination (i.e., categorial grammar).
- Return type:
- classmethod make_function_application()[source]#
Make the CCG composition system that only allows function application.
- Return type:
- try_compose(lhs, rhs)[source]#
Try to compose two elements. This function will try to compose the two elements with all allowed composition types, and return the result that works.
- Parameters:
lhs (CCGComposable) – the left-hand side element.
rhs (CCGComposable) – the right-hand side element.
- Returns:
The composition result.
- Return type:
- property allowed_composition_types#