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.5.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

template_analysis-0.0.5-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: template_analysis-0.0.5.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for template_analysis-0.0.5.tar.gz
Algorithm Hash digest
SHA256 eb7af1101c07c85fc5339a96871446319d7457d8e3d2bdda10687a156efa6807
MD5 1f65c97017c9370d0b4d82b6cdd1c145
BLAKE2b-256 1ac751e994b581bb0b564e1748cf90e71583b3420dd661bd2c011fd8253b146f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for template_analysis-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f4002a3ca012b856568e94ead59d100dcbd77401b6eb17ac8d7b306ecd308f6d
MD5 850e76c39c366cd1eadb67bb9d27fedb
BLAKE2b-256 696f5379436a1b27d8d27e3e4ed210b681c506b43ec6aad2a938a125fe2ae9f2

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