Skip to main content

Create template from strings (reverse formatter)

Project description

template-analysis

Python PyPI version codecov License

Generate template and extract variables from texts. In other words, template-analysis makes reverse template (untemplate).

Usage

Currently, this supports to analyze only two texts.

from template_analysis import analyze
result = analyze([
    "A dog is a good pet",
    "A cat is a good pet",
    "A cat is a pretty pet",
    "A bird is a great pet",
])
result.to_format_string()  # => "A {} is a {} pet"
result.args[0]  # => ["dog", "good"]
result.args[1]  # => ["cat", "good"]
result.args[2]  # => ["cat", "pretty"]
result.args[3]  # => ["bird", "great"]

Concepts / Future plans

Development plans

  • 1. Untemplate two texts.
  • 2. Untemplate multiple / complex texts.
  • 3. Untemplate nested / tree-structured texts.
  • 4. Support several features for scraping.
  • 5. Implement a more efficient algorithm.

Image boards

1-templating 2-untemplating 3-template-deriving 4-template-deriving-2 4-automated-scraping

License

The 3-Clause BSD License. See also LICENSE file.

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

template_analysis-0.0.2.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

template_analysis-0.0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file template_analysis-0.0.2.tar.gz.

File metadata

  • Download URL: template_analysis-0.0.2.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for template_analysis-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5b5904e4aebe4750ef1150affe9d6abb0496a80aebc24036ea6360695bc3c1da
MD5 6702b69d78ccd4cd131c61c8d9cc8f8b
BLAKE2b-256 a492c4fdcede2d179506f77655508d810faa2fc9d8024a014fa60701c51c9984

See more details on using hashes here.

File details

Details for the file template_analysis-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for template_analysis-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a50cc65f8aa14ac7e2184d17e0ed9a71037e4e3bfb3afef469f1a490eff9b29
MD5 59273bb27aec091374ab8f650305f0ff
BLAKE2b-256 46b7acab7a0ba68cfb12fedfadeaf495221076b5ec5e1597f62aa6be5c660614

See more details on using hashes here.

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