template-analysis


Nametemplate-analysis JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://github.com/kitsuyui/python-template-analysis
SummaryCreate template from strings (reverse formatter)
upload_time2023-10-06 05:15:29
maintainer
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": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "Yui Kitsu",
    "author_email": "kitsuyui+github@kitsuyui.com",
    "download_url": "https://files.pythonhosted.org/packages/04/66/08f3634a31beeb00aadb9e4e8642a8dd65e3f9e778a9863823b041d6463e/template_analysis-0.0.6.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.6",
    "project_urls": {
        "Homepage": "https://github.com/kitsuyui/python-template-analysis"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d8b8d619634f295d199a77c2771c297e92d8a4aff345e585cc70aadd8ab2f0d",
                "md5": "2fbfe9807f0f9f7e4a29e9c176f558b0",
                "sha256": "9dbced0daec83d101d2c1bd4772550d0473cd5b3dd24776330eaab337bc305ab"
            },
            "downloads": -1,
            "filename": "template_analysis-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2fbfe9807f0f9f7e4a29e9c176f558b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6631,
            "upload_time": "2023-10-06T05:15:27",
            "upload_time_iso_8601": "2023-10-06T05:15:27.935469Z",
            "url": "https://files.pythonhosted.org/packages/4d/8b/8d619634f295d199a77c2771c297e92d8a4aff345e585cc70aadd8ab2f0d/template_analysis-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "046608f3634a31beeb00aadb9e4e8642a8dd65e3f9e778a9863823b041d6463e",
                "md5": "77a996ee5af8419b5de93790a176aae9",
                "sha256": "47d26d64767a3cda904994b37f20a21fc1cbb43df2212014ccb8e219897c7739"
            },
            "downloads": -1,
            "filename": "template_analysis-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "77a996ee5af8419b5de93790a176aae9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 23035,
            "upload_time": "2023-10-06T05:15:29",
            "upload_time_iso_8601": "2023-10-06T05:15:29.667842Z",
            "url": "https://files.pythonhosted.org/packages/04/66/08f3634a31beeb00aadb9e4e8642a8dd65e3f9e778a9863823b041d6463e/template_analysis-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-06 05:15:29",
    "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.12454s