template-analysis


Nametemplate-analysis JSON
Version 0.0.7 PyPI version JSON
download
home_pagehttps://github.com/kitsuyui/python-template-analysis
SummaryCreate template from strings (reverse formatter)
upload_time2024-10-15 16:35:52
maintainerNone
docs_urlNone
authorYui Kitsu
requires_python>=3.9
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # template-analysis

[![Python](https://img.shields.io/pypi/pyversions/template-analysis.svg)](https://badge.fury.io/py/template-analysis)
[![PyPI version](https://img.shields.io/pypi/v/template-analysis.svg)](https://pypi.python.org/pypi/template-analysis/)
[![codecov](https://codecov.io/gh/kitsuyui/python-template-analysis/branch/main/graph/badge.svg?token=AMEP8YUYXA)](https://codecov.io/gh/kitsuyui/python-template-analysis)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

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.

```python
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

- [x] 1. Untemplate two texts.
- [x] 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](https://user-images.githubusercontent.com/2596972/73120667-7bafbf80-3fb4-11ea-823f-263c0010e0e9.png)
![2-untemplating](https://user-images.githubusercontent.com/2596972/73120668-7bafbf80-3fb4-11ea-9426-5471fcf2e601.png)
![3-template-deriving](https://user-images.githubusercontent.com/2596972/73120669-7bafbf80-3fb4-11ea-8236-1ab68f75ce60.png)
![4-template-deriving-2](https://user-images.githubusercontent.com/2596972/73120670-7c485600-3fb4-11ea-9eba-01aaafd08e4e.png)
![4-automated-scraping](https://user-images.githubusercontent.com/2596972/73120671-7c485600-3fb4-11ea-8ed6-56b93ee99b3a.png)

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kitsuyui/python-template-analysis",
    "name": "template-analysis",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Yui Kitsu",
    "author_email": "kitsuyui+github@kitsuyui.com",
    "download_url": "https://files.pythonhosted.org/packages/25/53/3cd35741eebe34b0b845c9b591608b0e1f889e6897f9345a41da4b7b641f/template_analysis-0.0.7.tar.gz",
    "platform": null,
    "description": "# template-analysis\n\n[![Python](https://img.shields.io/pypi/pyversions/template-analysis.svg)](https://badge.fury.io/py/template-analysis)\n[![PyPI version](https://img.shields.io/pypi/v/template-analysis.svg)](https://pypi.python.org/pypi/template-analysis/)\n[![codecov](https://codecov.io/gh/kitsuyui/python-template-analysis/branch/main/graph/badge.svg?token=AMEP8YUYXA)](https://codecov.io/gh/kitsuyui/python-template-analysis)\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\nGenerate template and extract variables from texts.\nIn other words, template-analysis makes reverse template (untemplate).\n\n## Usage\n\nCurrently, this supports to analyze only two texts.\n\n```python\nfrom template_analysis import analyze\nresult = analyze([\n    \"A dog is a good pet\",\n    \"A cat is a good pet\",\n    \"A cat is a pretty pet\",\n    \"A bird is a great pet\",\n])\nresult.to_format_string()  # => \"A {} is a {} pet\"\nresult.args[0]  # => [\"dog\", \"good\"]\nresult.args[1]  # => [\"cat\", \"good\"]\nresult.args[2]  # => [\"cat\", \"pretty\"]\nresult.args[3]  # => [\"bird\", \"great\"]\n```\n\n## Concepts / Future plans\n\n### Development plans\n\n- [x] 1. Untemplate two texts.\n- [x] 2. Untemplate multiple / complex texts.\n- [ ] 3. Untemplate nested / tree-structured texts.\n- [ ] 4. Support several features for scraping.\n- [ ] 5. Implement a more efficient algorithm.\n\n### Image boards\n\n![1-templating](https://user-images.githubusercontent.com/2596972/73120667-7bafbf80-3fb4-11ea-823f-263c0010e0e9.png)\n![2-untemplating](https://user-images.githubusercontent.com/2596972/73120668-7bafbf80-3fb4-11ea-9426-5471fcf2e601.png)\n![3-template-deriving](https://user-images.githubusercontent.com/2596972/73120669-7bafbf80-3fb4-11ea-8236-1ab68f75ce60.png)\n![4-template-deriving-2](https://user-images.githubusercontent.com/2596972/73120670-7c485600-3fb4-11ea-9eba-01aaafd08e4e.png)\n![4-automated-scraping](https://user-images.githubusercontent.com/2596972/73120671-7c485600-3fb4-11ea-8ed6-56b93ee99b3a.png)\n\n## License\n\nThe 3-Clause BSD License. See also LICENSE file.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Create template from strings (reverse formatter)",
    "version": "0.0.7",
    "project_urls": {
        "Homepage": "https://github.com/kitsuyui/python-template-analysis"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c136e914b73c18312e422a078fd640c1b54fd08751215a2c408c5cf188051fb5",
                "md5": "0dc431e0913ecc76e8a4b13eba6574d3",
                "sha256": "6fbe57c4858d050fe1cb8f79021768df8dc555e6f9f10f951415d64a1e3f80ec"
            },
            "downloads": -1,
            "filename": "template_analysis-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0dc431e0913ecc76e8a4b13eba6574d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6646,
            "upload_time": "2024-10-15T16:35:50",
            "upload_time_iso_8601": "2024-10-15T16:35:50.456452Z",
            "url": "https://files.pythonhosted.org/packages/c1/36/e914b73c18312e422a078fd640c1b54fd08751215a2c408c5cf188051fb5/template_analysis-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25533cd35741eebe34b0b845c9b591608b0e1f889e6897f9345a41da4b7b641f",
                "md5": "00b780d7f7b1482517e7f59dfa074ef2",
                "sha256": "e61c5caf8887d632c8c71a401e66e58a2b673753ad82c748be082817f9f8d681"
            },
            "downloads": -1,
            "filename": "template_analysis-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "00b780d7f7b1482517e7f59dfa074ef2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 24743,
            "upload_time": "2024-10-15T16:35:52",
            "upload_time_iso_8601": "2024-10-15T16:35:52.093268Z",
            "url": "https://files.pythonhosted.org/packages/25/53/3cd35741eebe34b0b845c9b591608b0e1f889e6897f9345a41da4b7b641f/template_analysis-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-15 16:35:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kitsuyui",
    "github_project": "python-template-analysis",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "template-analysis"
}
        
Elapsed time: 0.35464s