concepts.language.ccg.composition.CCGCompositionContext#

class CCGCompositionContext[source]#

Bases: OptionContext

An option context for CCG composition.

Methods

as_default()

Make this option context the current context.

exc([exc_type, from_])

Context manager for handling composition errors.

get_default()

Get the current option context.

get_option(name)

Get the option value of the current context.

set_default_option(name, value)

Set the option value for the current context.

Attributes

syntax

Whether to perform syntax composition.

semantics

Whether to perform semantics composition.

semantics_lazy_composition

Whether to perform lazy semantics composition.

exc_verbose

Whether to raise verbose exceptions.

__init__(**init_kwargs)#
__new__(**kwargs)#
as_default()#

Make this option context the current context. It will overwrite the current option values.

exc(exc_type=None, from_=None)[source]#

Context manager for handling composition errors. If exc_verbose is True, the error will be printed out.

Example

>>> with get_ccg_composition_context().exc():
>>>     raise CCGCompositionError('some error')
Parameters:
  • exc_type (type | None) – the exception type to raise. If None, the original exception will be raised.

  • from – the original exception to raise.

  • from_ (Exception | None)

classmethod get_default()#

Get the current option context.

classmethod get_option(name)#

Get the option value of the current context.

classmethod set_default_option(name, value)#

Set the option value for the current context.

exc_verbose: bool#

Whether to raise verbose exceptions.

semantics: bool#

Whether to perform semantics composition.

semantics_lazy_composition: bool#

Whether to perform lazy semantics composition.

syntax: bool#

Whether to perform syntax composition.