Skip to main content

Expand prompt matrix strings

Project description

Prompt Matrix

Python PyPI

A Python package to expand prompt matrix strings, e.g. the string "The <dog|cat> in the hat" expands to the list ["The dog in the hat", "The cat in the hat"].

Install

$ pip install prompt-matrix

Usage

import prompt_matrix

prompt_matrix.expand("The <dog|cat> in the <cardigan|hat>")
# ->
# ["The dog in the cardigan",
#  "The dog in the hat",
#  "The cat in the cardigan",
#  "The cat in the hat"]

prompt_matrix.expand("The <<small|large> <brown|black> dog|<red|blue> fish>")
# ["The small brown dog",
#  "The small black dog",
#  "The large brown dog",
#  "The large black dog",
#  "The red fish",
#  "The blue fish"]

prompt_matrix.expand("The {dog,cat} in the {cardigan,hat}", brackets=['{', '}'], alt=',')
# ["The dog in the cardigan",
#  "The dog in the hat",
#  "The cat in the cardigan",
#  "The cat in the hat"]

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prompt_matrix-0.1.1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

prompt_matrix-0.1.1-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page