Preprocessors¶
Preprocessors for Clingo-Explaid.
__all__ = ['AssumptionPreprocessor', 'FilterPattern', 'FilterSignature']
module-attribute
¶
AssumptionPreprocessor(filters: Iterable[FilterPattern | FilterSignature] | None = None, control: clingo.Control | None = None, fail_on_unprocessed: bool = True)
¶
Preprocessor object that transforms program facts to choices for them tobe assumed.
Construct an AssumptionPreprocessor for the provided control, transforming facts matching the provided filters.
| PARAMETER | DESCRIPTION |
|---|---|
filters
|
The set of filters matching facts to transform.
TYPE:
|
control
|
The clingo Control object to use.
TYPE:
|
fail_on_unprocessed
|
Whether to fail if assumptions are accessed before a program is processed.
TYPE:
|
assumptions: set[tuple[clingo.Symbol, bool]]
property
¶
Assumptions generated by the preprocessor after calling process.
constants: dict[str, clingo.Symbol]
property
¶
Constants generated by the preprocessor after calling process.
process(program_string: str) -> str
¶
Process the provided program string and return the transformed program string (control is also updated).
| PARAMETER | DESCRIPTION |
|---|---|
program_string
|
The ASP program to be transformed.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
transformed_string
|
The transformed ASP program |
process_files(files: list[str] | None = None) -> str
¶
Process the provided files and return the transformed program string (control is also updated).
| PARAMETER | DESCRIPTION |
|---|---|
files
|
A list of ASP program files to be transformed |
| RETURNS | DESCRIPTION |
|---|---|
transformed_string
|
The combined transformed ASP program of all the input |
register_ast(ast: AST, builder: ProgramBuilder) -> None
¶
Register the provided AST to the builder and the parsed rules list.
| PARAMETER | DESCRIPTION |
|---|---|
ast
|
TYPE:
|
builder
|
Builder object which the
TYPE:
|
FilterPattern(pattern: str)
dataclass
¶
FilterSignature(name: str, arity: int)
dataclass
¶
preprocessor_assumption
¶
Assumption Preprocessor for converting facts to choices that can be assumed.
AssumptionPreprocessor(filters: Iterable[FilterPattern | FilterSignature] | None = None, control: clingo.Control | None = None, fail_on_unprocessed: bool = True)
¶
Preprocessor object that transforms program facts to choices for them tobe assumed.
Construct an AssumptionPreprocessor for the provided control, transforming facts matching the provided filters.
| PARAMETER | DESCRIPTION |
|---|---|
filters
|
The set of filters matching facts to transform.
TYPE:
|
control
|
The clingo Control object to use.
TYPE:
|
fail_on_unprocessed
|
Whether to fail if assumptions are accessed before a program is processed.
TYPE:
|
assumptions: set[tuple[clingo.Symbol, bool]]
property
¶
Assumptions generated by the preprocessor after calling process.
constants: dict[str, clingo.Symbol]
property
¶
Constants generated by the preprocessor after calling process.
process(program_string: str) -> str
¶
Process the provided program string and return the transformed program string (control is also updated).
| PARAMETER | DESCRIPTION |
|---|---|
program_string
|
The ASP program to be transformed.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
transformed_string
|
The transformed ASP program |
process_files(files: list[str] | None = None) -> str
¶
Process the provided files and return the transformed program string (control is also updated).
| PARAMETER | DESCRIPTION |
|---|---|
files
|
A list of ASP program files to be transformed |
| RETURNS | DESCRIPTION |
|---|---|
transformed_string
|
The combined transformed ASP program of all the input |
register_ast(ast: AST, builder: ProgramBuilder) -> None
¶
Register the provided AST to the builder and the parsed rules list.
| PARAMETER | DESCRIPTION |
|---|---|
ast
|
TYPE:
|
builder
|
Builder object which the
TYPE:
|