Skip to main content

ddcompiler

ddcompiler is the parser used by AutomationEdge AI Studio dialog designer. In dialog designer, conditions can be used either in an action dialog element or a branch dialog element. A condition is an expression which evaluates either to True or False. ddcompiler has a lexer and a parser which respectively tokenizes and parses the given expression.

Installation

pip install ddcompiler will install the library. It has been tested with Python 3.9.6, but should work with any Python 3.* version.

Basic Usage

import ddcompiler as ddc
var_dict = {
    'conv.lang': 'fr',
}

# Variables used in the expression of the form ${var_name} should be present in the var_dict.
expression = '${conv.lang} == "fr" or ${conv.lang} == "de" and contains("aistudio", "studio")'

# Instantiate parser and lexer, pass expression to the lexer.
ddparser = ddc.DDParser(ddc.DDLexer(expression))
tree = ddparser.parse()
# Prints parse tree
tree.traverse()
# Get list of variables used in the expression in form of a set
print(f"VARIABLES in the expression: {ddparser.get_variables()}")

print(f"INPUT: {expression}")
print(f"EVALUATION: {tree.evaluate(var_dict)}")

Expression Language

Visit AI Studio documentation to get list of supported constructs.

More Examples

Go through parser test file to see different examples of expressions.

Metadata

Release files for ddcompiler 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ddcompiler 1.1.0
File Size Uploaded Provenance Actions
ddcompiler-1.1.0.tar.gz 9.9 kB Without provenance Details for ddcompiler-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ddcompiler 1.1.0
File Interpreter ABI Platform Actions
ddcompiler-1.1.0-py3-none-any.whl Python 3 none any Details for ddcompiler-1.1.0-py3-none-any.whl

Total release size: 20.1 kB

Release files / ddcompiler-1.1.0.tar.gz

Download URL ddcompiler-1.1.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
39dfc719bd05a8c9ed499e9ab5b966cf332a36cfbf0120a093ead18d5d962c32
BLAKE2b-256 checksum
How to use checksums
f2ddcbc41a9e3d46d23292ada5afe1eade23aa995ef9d92aebc446c302d6293d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.6 Darwin/20.5.0

Release files / ddcompiler-1.1.0-py3-none-any.whl

Download URL ddcompiler-1.1.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4571b64559e9dc303680bc67ecc02e25b99aa039f766f392addd7ce4ddd4cbf
BLAKE2b-256 checksum
How to use checksums
86dc04873b467e6b0208b8cdae8271a1a4a2bab32a61a7f8c56720aba267b97d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.6 Darwin/20.5.0

Security for ddcompiler 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page