Name | redlines JSON |
Version |
0.5.1
JSON |
| download |
home_page | https://houfu.github.io/redlines/ |
Summary | Compare text, and produce human-readable differences or deltas which look like track changes in Microsoft Word. |
upload_time | 2024-11-07 14:32:45 |
maintainer | None |
docs_url | None |
author | houfu |
requires_python | <4.0,>=3.8 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Redlines
![Repository banner image](repository-open-graph.png)
![PyPI - Version](https://img.shields.io/pypi/v/redlines)
![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/houfu/redlines)
![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/houfu/redlines)
![PyPI - License](https://img.shields.io/pypi/l/redlines)
[![Chat on Matrix](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#redlines:matrix.esq.social)
`Redlines` produces a text showing the differences between two strings/text. The changes are represented with
strike-throughs and underlines, which looks similar to Microsoft Word's track changes. This method of showing changes is
more familiar to lawyers and is more compact for long series of characters.
Redlines uses [SequenceMatcher](https://docs.python.org/3/library/difflib.html#difflib.SequenceMatcher)
to find differences between words used.
The output can be in HTML, Markdown, or `rich` format.
## Example
Given an original string:
The quick brown fox jumps over the lazy dog.
And the string to be tested with:
The quick brown fox walks past the lazy dog.
The library gives a result of:
The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog.
Which is rendered like this:
> The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog.
The library can also output the results in Markdown, HTML or `rich` format, and
for a variety of environments like Streamlit, Jupyter Notebooks, Google Colab and the terminal.
## Install
```shell
pip install redlines
```
## Usage
The library contains one class: `Redlines`, which is used to compare text.
```python
from redlines import Redlines
test = Redlines(
"The quick brown fox jumps over the lazy dog.",
"The quick brown fox walks past the lazy dog.", markdown_style="none",
)
assert (
test.output_markdown
== "The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog."
)
```
Alternatively, you can create Redline with the text to be tested, and compare several times to see the results.
```python
from redlines import Redlines
test = Redlines("The quick brown fox jumps over the lazy dog.", markdown_style="none")
assert (
test.compare("The quick brown fox walks past the lazy dog.")
== "The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog."
)
assert (
test.compare("The quick brown fox jumps over the dog.")
== "The quick brown fox jumps over the <del>lazy </del>dog."
)
```
Redlines also features a simple command line tool `redlines` to visualise the differences in text in the terminal.
```
Usage: redlines text [OPTIONS] SOURCE TEST
Compares the strings SOURCE and TEST and produce a redline in the terminal.
```
You may also want to check out the demo project [redlines-textual](https://github.com/houfu/redlines-textual).
## Documentation
[Read the available Documentation](https://houfu.github.io/redlines).
## Uses
* View and mark changes in legislation: [PLUS Explorer](https://houfu-plus-explorer.streamlit.app/)
* Visualise changes after ChatGPT transforms a
text: [ChatGPT Prompt Engineering for Developers](https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/)
Lesson 6
## License
MIT License
Raw data
{
"_id": null,
"home_page": "https://houfu.github.io/redlines/",
"name": "redlines",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "houfu",
"author_email": "houfu@outlook.sg",
"download_url": "https://files.pythonhosted.org/packages/3b/b7/877ecb46f4f3e1ef5f75f4a272ba34fffae087ceebf49bae4785ab3d17e1/redlines-0.5.1.tar.gz",
"platform": null,
"description": "# Redlines\n![Repository banner image](repository-open-graph.png)\n![PyPI - Version](https://img.shields.io/pypi/v/redlines)\n![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/houfu/redlines)\n![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/houfu/redlines)\n![PyPI - License](https://img.shields.io/pypi/l/redlines)\n[![Chat on Matrix](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#redlines:matrix.esq.social)\n\n`Redlines` produces a text showing the differences between two strings/text. The changes are represented with\nstrike-throughs and underlines, which looks similar to Microsoft Word's track changes. This method of showing changes is\nmore familiar to lawyers and is more compact for long series of characters.\n\nRedlines uses [SequenceMatcher](https://docs.python.org/3/library/difflib.html#difflib.SequenceMatcher)\nto find differences between words used.\nThe output can be in HTML, Markdown, or `rich` format.\n\n## Example\n\nGiven an original string:\n\n The quick brown fox jumps over the lazy dog.\n\nAnd the string to be tested with:\n\n The quick brown fox walks past the lazy dog.\n\nThe library gives a result of:\n\n The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog.\n\nWhich is rendered like this:\n\n> The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog.\n\nThe library can also output the results in Markdown, HTML or `rich` format, and\nfor a variety of environments like Streamlit, Jupyter Notebooks, Google Colab and the terminal.\n\n## Install\n\n```shell\npip install redlines\n```\n\n## Usage\n\nThe library contains one class: `Redlines`, which is used to compare text.\n\n```python\nfrom redlines import Redlines\n\ntest = Redlines(\n \"The quick brown fox jumps over the lazy dog.\",\n \"The quick brown fox walks past the lazy dog.\", markdown_style=\"none\",\n)\nassert (\n test.output_markdown\n == \"The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog.\"\n)\n```\n\nAlternatively, you can create Redline with the text to be tested, and compare several times to see the results.\n\n```python\nfrom redlines import Redlines\n\ntest = Redlines(\"The quick brown fox jumps over the lazy dog.\", markdown_style=\"none\")\nassert (\n test.compare(\"The quick brown fox walks past the lazy dog.\")\n == \"The quick brown fox <del>jumps over </del><ins>walks past </ins>the lazy dog.\"\n)\n\nassert (\n test.compare(\"The quick brown fox jumps over the dog.\")\n == \"The quick brown fox jumps over the <del>lazy </del>dog.\"\n)\n```\n\nRedlines also features a simple command line tool `redlines` to visualise the differences in text in the terminal.\n\n```\n Usage: redlines text [OPTIONS] SOURCE TEST \n \n Compares the strings SOURCE and TEST and produce a redline in the terminal. \n```\n\nYou may also want to check out the demo project [redlines-textual](https://github.com/houfu/redlines-textual).\n\n## Documentation\n\n[Read the available Documentation](https://houfu.github.io/redlines).\n\n## Uses\n\n* View and mark changes in legislation: [PLUS Explorer](https://houfu-plus-explorer.streamlit.app/)\n* Visualise changes after ChatGPT transforms a\n text: [ChatGPT Prompt Engineering for Developers](https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/)\n Lesson 6\n\n## License\n\nMIT License\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Compare text, and produce human-readable differences or deltas which look like track changes in Microsoft Word.",
"version": "0.5.1",
"project_urls": {
"Homepage": "https://houfu.github.io/redlines/",
"Repository": "https://github.com/houfu/redlines"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fcec9095a088bc0db80bd6daa752ba5d92b838213065fe02d172a3f14d6dd967",
"md5": "2e5d85ee6a30d3851c8e483b74cfe17b",
"sha256": "aa7bbe263d2bf46a0ea880b8d92ffd4d869b4a7c444b1e2fde307fbb7763a7b7"
},
"downloads": -1,
"filename": "redlines-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2e5d85ee6a30d3851c8e483b74cfe17b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 12741,
"upload_time": "2024-11-07T14:32:43",
"upload_time_iso_8601": "2024-11-07T14:32:43.740665Z",
"url": "https://files.pythonhosted.org/packages/fc/ec/9095a088bc0db80bd6daa752ba5d92b838213065fe02d172a3f14d6dd967/redlines-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3bb7877ecb46f4f3e1ef5f75f4a272ba34fffae087ceebf49bae4785ab3d17e1",
"md5": "15ec29141268f7d97a4ee2ac6371fb2c",
"sha256": "3474e2ce76b50695ac4ab2999a8c7bb8949b99f76083f0d8ebd510a0e4d888f8"
},
"downloads": -1,
"filename": "redlines-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "15ec29141268f7d97a4ee2ac6371fb2c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 10711,
"upload_time": "2024-11-07T14:32:45",
"upload_time_iso_8601": "2024-11-07T14:32:45.107647Z",
"url": "https://files.pythonhosted.org/packages/3b/b7/877ecb46f4f3e1ef5f75f4a272ba34fffae087ceebf49bae4785ab3d17e1/redlines-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-07 14:32:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "houfu",
"github_project": "redlines",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "redlines"
}