Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 2.05 KB

README.md

File metadata and controls

50 lines (38 loc) · 2.05 KB

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.