concepts.language.ccg.search.CCGSemanticsEnumerativeSearcher#
- class CCGSemanticsEnumerativeSearcher[source]#
Bases:
CCGSemanticsSearcherBase
Enumerative searcher for semantics.
Methods
gen
([max_depth, return_type, ...])Generate a list of candidate semantic forms.
gen_constant_semantics
([return_type])Generate a list of candidate semantic forms that are simply constants.
gen_function_semantics
([return_type, ...])gen_lambda
(f1[, arg_index, f2])- __init__(domain)[source]#
Initialize the searcher.
- Parameters:
domain (FunctionDomain) – the domain of the semantics.
- __new__(**kwargs)#
- gen(max_depth=ARGDEF, return_type=None, max_variable_arguments=ARGDEF, max_constant_arguments=ARGDEF, max_function_arguments=ARGDEF, search_constants=ARGDEF, hash_function=None, verbose=False)[source]#
Generate a list of candidate semantic forms.
- Parameters:
max_depth (int) – the maximum depth of the semantics tree.
return_type (ObjectType | ValueType | FunctionType | Tuple[ObjectType | ValueType | FunctionType, ...] | List[ObjectType | ValueType | FunctionType] | None) – the return type of the semantics.
max_variable_arguments (int) – the maximum number of variables in the semantics.
max_constant_arguments (int) – the maximum number of constants in the semantics.
max_function_arguments (int) – the maximum number of functions in the semantics.
search_constants (bool) – whether to search for constants when generating semantic forms.
hash_function (Callable[[Function | FunctionApplicationExpression], Any]) – an optional hash function that will be used to filter out duplicate functions.
verbose (bool) – whether to print out the progress.
- Returns:
A list of candidate semantic forms.
- Return type:
- gen_constant_semantics(return_type=None)[source]#
Generate a list of candidate semantic forms that are simply constants.
- Parameters:
return_type (ObjectType | ValueType | FunctionType | Tuple[ObjectType | ValueType | FunctionType, ...] | List[ObjectType | ValueType | FunctionType] | None) – the return type of the semantics.
- Returns:
A list of candidate semantic forms.
- Return type:
- gen_function_semantics(return_type=None, *, max_depth=3, max_variable_arguments=2, max_constant_arguments=1, max_function_arguments=0, search_constants=False, hash_function=None, verbose=False)[source]#
- Parameters:
return_type (ObjectType | ValueType | FunctionType | Tuple[ObjectType | ValueType | FunctionType, ...] | List[ObjectType | ValueType | FunctionType] | None)
max_depth (int)
max_variable_arguments (int)
max_constant_arguments (int)
max_function_arguments (int)
search_constants (bool)
hash_function (Callable[[Function | FunctionApplicationExpression], Any])
verbose (bool)
- Return type: