Name | pynarrator JSON |
Version |
0.0.1.15
JSON |
| download |
home_page | |
Summary | Template-based NLG framework for creating text narratives out of data |
upload_time | 2023-07-04 19:07:47 |
maintainer | |
docs_url | None |
author | Denis Abdullin |
requires_python | |
license | |
keywords |
python
nlg
template
chatgpt
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pynarrator
Template-based NLG framework for creating text narratives out of data
## Installation
You can install the package from pip:
```bash
pip3 install pynarrator
```
```python
import os
from pynarrator import narrate_descriptive, read_data
```
## Basic Usage
pynarrator has a range of functions for creating template-based narratives and also embedded data set that you can use by calling `read_data()`. Function downloads raw data from github, if you get a SSL error when running it, please run this first:
```python
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
```
```python
sales = read_data()
narrative = narrate_descriptive(sales, measure = 'Sales', dimensions = ['Region', 'Product'], coverage = 0.5)
```
{'Total Sales': 'Total Sales across all Regions is 38790478.42.',
'Region by Sales': 'Outlying Regions by Sales are NA (18079736.4, 47.0%), EMEA (13555412.7, 35.0%).',
'Product by Sales': 'Outlying Products by Sales are Food & Beverage (15543469.7, 40.0%), Electronics (8608962.8, 22.0%).'}
## Chat GPT
In order to use ChatGPT in pynarrator, you must specify your OpenAI API token as `OPENAI_API_KEY` environment variable:
```python
os.environ['OPENAI_API_KEY'] = 'xx-xxxxxxxxxx'
```
```python
from pynarrator import gpt_get_completions, enhance_narrative, translate_narrative, summarize_narrative
```
Improve the narrative text to make it rich with business language
```python
enhance_narrative(narrative)
```
```python
enhance_narrative(narrative, language = 'Spanish')
```
```python
summarize_narrative(narrative)
```
Complete documentation is available at the [narrator](https://denisabd.github.io/narrator/) package website
Raw data
{
"_id": null,
"home_page": "",
"name": "pynarrator",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,nlg,template,chatgpt",
"author": "Denis Abdullin",
"author_email": "denisabdullincz@gmail.com",
"download_url": "",
"platform": null,
"description": "# pynarrator\n Template-based NLG framework for creating text narratives out of data\n\n## Installation\n\nYou can install the package from pip:\n\n```bash\npip3 install pynarrator\n```\n\n```python\nimport os\nfrom pynarrator import narrate_descriptive, read_data\n```\n\n## Basic Usage\n\npynarrator has a range of functions for creating template-based narratives and also embedded data set that you can use by calling `read_data()`. Function downloads raw data from github, if you get a SSL error when running it, please run this first:\n\n```python\nimport ssl\nssl._create_default_https_context = ssl._create_unverified_context\n```\n\n```python\nsales = read_data()\nnarrative = narrate_descriptive(sales, measure = 'Sales', dimensions = ['Region', 'Product'], coverage = 0.5)\n```\n\n{'Total Sales': 'Total Sales across all Regions is 38790478.42.',\n 'Region by Sales': 'Outlying Regions by Sales are NA (18079736.4, 47.0%), EMEA (13555412.7, 35.0%).',\n 'Product by Sales': 'Outlying Products by Sales are Food & Beverage (15543469.7, 40.0%), Electronics (8608962.8, 22.0%).'}\n\n## Chat GPT\n\nIn order to use ChatGPT in pynarrator, you must specify your OpenAI API token as `OPENAI_API_KEY` environment variable:\n\n```python\nos.environ['OPENAI_API_KEY'] = 'xx-xxxxxxxxxx'\n```\n\n```python\n from pynarrator import gpt_get_completions, enhance_narrative, translate_narrative, summarize_narrative\n```\n\nImprove the narrative text to make it rich with business language\n\n```python\nenhance_narrative(narrative)\n```\n\n```python\nenhance_narrative(narrative, language = 'Spanish')\n```\n\n```python\nsummarize_narrative(narrative)\n```\n\nComplete documentation is available at the [narrator](https://denisabd.github.io/narrator/) package website\n",
"bugtrack_url": null,
"license": "",
"summary": "Template-based NLG framework for creating text narratives out of data",
"version": "0.0.1.15",
"project_urls": null,
"split_keywords": [
"python",
"nlg",
"template",
"chatgpt"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "050faedc06a300013c7db4e28ef7c7bac36b115671589d19ae9ce703dfabff6e",
"md5": "7f98dbcc9b2641fae91b11f2b98839ab",
"sha256": "937b9b437a0a4244657fe81dba7a6b96d8541855819cacf1c1533105464e0b70"
},
"downloads": -1,
"filename": "pynarrator-0.0.1.15-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7f98dbcc9b2641fae91b11f2b98839ab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 23660,
"upload_time": "2023-07-04T19:07:47",
"upload_time_iso_8601": "2023-07-04T19:07:47.222641Z",
"url": "https://files.pythonhosted.org/packages/05/0f/aedc06a300013c7db4e28ef7c7bac36b115671589d19ae9ce703dfabff6e/pynarrator-0.0.1.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-04 19:07:47",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pynarrator"
}