a-pandas-ex-text-compare


Namea-pandas-ex-text-compare JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/a_pandas_ex_text_compare
SummaryCompares 2 texts with each other, and returns a Pandas DataFrame
upload_time2023-04-24 15:44:13
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords string text pandas dataframe read difflib fuzz fuzzy
VCS
bugtrack_url
requirements a_pandas_ex_bs4df_lite flatten_everything pandas regex
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Compares 2 texts with each other, and returns a Pandas DataFrame

```python
pip install a-pandas-ex_text-compare
```

```python
from a_pandas_ex_text_compare import pd_add_text_difference
import pandas as pd

pd_add_text_difference()



# Examples of possible inputs (bytes, list, string, path (as string))

text1 = """  1. Beautiful isxx better than ugly.
  2. Explicit isq better than implicit.
  3. Simple is better than complex.
  4. Complex is better than complicated.
"""

text2 = """  
1. Beautiful is better than ugly.
  2. Explicit is better than implicit.
  3. qSimple is better than pcomplex.
  4. Complicated aais better than complex.
  5. Flat is better than nested.
""".splitlines(
    keepends=True
)
text2 = '''The green man wakes and sees her place
The spectacles upon her face;
And now she's trying all she can
To shoot the sleepy, green-coat man.
He cries and screams and runs away;
The hare runs after him all day
The hare runs after him all day
And hears him call out everywhere:
"Help! Fire! Help! The Hare! The Hare!"'''.encode()

text1 = b'''The yellow man wakes and sees her place
The spectacles upon her face;
The spectacles upon her face;
And now she is trying all that she can
To shoot the tired, green-coat man.
He cries and screams and runs away;
The hare runs after him the whole day
And hears him call out everywhere:
and hears him call out everywhere:
"Help! Fire! Help! The Hare! The Hare!"'''

text1 = r"C:\Users\Gamer\Documents\Downloads\testread.txt"


df = pd.Q_text_difference_to_df(text1, text2, encoding="utf-8")
print(df.to_string())

"""
    no                                  aa_text                                  bb_text                            aa_added                   bb_substracted aa_changed bb_changed                                         aa_diff                                      bb_diff                                          aa_parts                                           bb_parts
0    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>          y         gr                                   (diff_chg, y)                               (diff_chg, gr)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)
1    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>       llow         gr                                (diff_chg, llow)                               (diff_chg, gr)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)
2    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>          y         en                                   (diff_chg, y)                               (diff_chg, en)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)
3    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>       llow         en                                (diff_chg, llow)                               (diff_chg, en)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)
4    1            The spectacles upon her face;            The spectacles upon her face;                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN                  (The spectacles upon her face;,)                   (The spectacles upon her face;,)
5    2                                                     The spectacles upon her face;       The spectacles upon her face;                             <NA>       <NA>       <NA>       (diff_add, The spectacles upon her face;)                                          NaN                                                ()                   (The spectacles upon her face;,)
6    3                                                     The spectacles upon her face;       The spectacles upon her face;                             <NA>       <NA>       <NA>       (diff_add, The spectacles upon her face;)                                          NaN                                                ()                   (The spectacles upon her face;,)
7    4         And now she's trying all she can   And now she is trying all that she can                                <NA>                             <NA>          i          '                                  (diff_chg,  i)                                (diff_chg, ')            (And now she, ', s trying all she can)   (And now she,  i, s trying all , that , she can)
8    4         And now she's trying all she can   And now she is trying all that she can                               that                              <NA>       <NA>          '                               (diff_add, that )                                (diff_chg, ')            (And now she, ', s trying all she can)   (And now she,  i, s trying all , that , she can)
9    5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>        tir         sl                                 (diff_chg, tir)                               (diff_chg, sl)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)
10   5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>          d         sl                                   (diff_chg, d)                               (diff_chg, sl)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)
11   5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>        tir        epy                                 (diff_chg, tir)                              (diff_chg, epy)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)
12   5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>          d        epy                                   (diff_chg, d)                              (diff_chg, epy)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)
13   6      He cries and screams and runs away;      He cries and screams and runs away;                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN            (He cries and screams and runs away;,)             (He cries and screams and runs away;,)
14   7          The hare runs after him all day          The hare runs after him all day                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN                (The hare runs after him all day,)                 (The hare runs after him all day,)
15   8          The hare runs after him all day       And hears him call out everywhere:  And hears him call out everywhere:  The hare runs after him all day       <NA>       <NA>  (diff_add, And hears him call out everywhere:)  (diff_sub, The hare runs after him all day)                (The hare runs after him all day,)              (And hears him call out everywhere:,)
16   9       And hears him call out everywhere:       And hears him call out everywhere:                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN             (And hears him call out everywhere:,)              (And hears him call out everywhere:,)
17  10  "Help! Fire! Help! The Hare! The Hare!"  "Help! Fire! Help! The Hare! The Hare!"                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN        ("Help! Fire! Help! The Hare! The Hare!",)         ("Help! Fire! Help! The Hare! The Hare!",)


"""

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/a_pandas_ex_text_compare",
    "name": "a-pandas-ex-text-compare",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "string,text,pandas,DataFrame,read,difflib,fuzz,fuzzy",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/87/18/7b30c05770bb7cf5a61d2370077d715f1d61a5b9c8a9e1510d82d8318e17/a_pandas_ex_text_compare-0.11.tar.gz",
    "platform": null,
    "description": "# Compares 2 texts with each other, and returns a Pandas DataFrame\r\n\r\n```python\r\npip install a-pandas-ex_text-compare\r\n```\r\n\r\n```python\r\nfrom a_pandas_ex_text_compare import pd_add_text_difference\r\nimport pandas as pd\r\n\r\npd_add_text_difference()\r\n\r\n\r\n\r\n# Examples of possible inputs (bytes, list, string, path (as string))\r\n\r\ntext1 = \"\"\"  1. Beautiful isxx better than ugly.\r\n  2. Explicit isq better than implicit.\r\n  3. Simple is better than complex.\r\n  4. Complex is better than complicated.\r\n\"\"\"\r\n\r\ntext2 = \"\"\"  \r\n1. Beautiful is better than ugly.\r\n  2. Explicit is better than implicit.\r\n  3. qSimple is better than pcomplex.\r\n  4. Complicated aais better than complex.\r\n  5. Flat is better than nested.\r\n\"\"\".splitlines(\r\n    keepends=True\r\n)\r\ntext2 = '''The green man wakes and sees her place\r\nThe spectacles upon her face;\r\nAnd now she's trying all she can\r\nTo shoot the sleepy, green-coat man.\r\nHe cries and screams and runs away;\r\nThe hare runs after him all day\r\nThe hare runs after him all day\r\nAnd hears him call out everywhere:\r\n\"Help! Fire! Help! The Hare! The Hare!\"'''.encode()\r\n\r\ntext1 = b'''The yellow man wakes and sees her place\r\nThe spectacles upon her face;\r\nThe spectacles upon her face;\r\nAnd now she is trying all that she can\r\nTo shoot the tired, green-coat man.\r\nHe cries and screams and runs away;\r\nThe hare runs after him the whole day\r\nAnd hears him call out everywhere:\r\nand hears him call out everywhere:\r\n\"Help! Fire! Help! The Hare! The Hare!\"'''\r\n\r\ntext1 = r\"C:\\Users\\Gamer\\Documents\\Downloads\\testread.txt\"\r\n\r\n\r\ndf = pd.Q_text_difference_to_df(text1, text2, encoding=\"utf-8\")\r\nprint(df.to_string())\r\n\r\n\"\"\"\r\n    no                                  aa_text                                  bb_text                            aa_added                   bb_substracted aa_changed bb_changed                                         aa_diff                                      bb_diff                                          aa_parts                                           bb_parts\r\n0    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>          y         gr                                   (diff_chg, y)                               (diff_chg, gr)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)\r\n1    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>       llow         gr                                (diff_chg, llow)                               (diff_chg, gr)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)\r\n2    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>          y         en                                   (diff_chg, y)                               (diff_chg, en)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)\r\n3    0   The green man wakes and sees her place  The yellow man wakes and sees her place                                <NA>                             <NA>       llow         en                                (diff_chg, llow)                               (diff_chg, en)  (The , gr, e, en,  man wakes and sees her place)  (The , y, e, llow,  man wakes and sees her place)\r\n4    1            The spectacles upon her face;            The spectacles upon her face;                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN                  (The spectacles upon her face;,)                   (The spectacles upon her face;,)\r\n5    2                                                     The spectacles upon her face;       The spectacles upon her face;                             <NA>       <NA>       <NA>       (diff_add, The spectacles upon her face;)                                          NaN                                                ()                   (The spectacles upon her face;,)\r\n6    3                                                     The spectacles upon her face;       The spectacles upon her face;                             <NA>       <NA>       <NA>       (diff_add, The spectacles upon her face;)                                          NaN                                                ()                   (The spectacles upon her face;,)\r\n7    4         And now she's trying all she can   And now she is trying all that she can                                <NA>                             <NA>          i          '                                  (diff_chg,  i)                                (diff_chg, ')            (And now she, ', s trying all she can)   (And now she,  i, s trying all , that , she can)\r\n8    4         And now she's trying all she can   And now she is trying all that she can                               that                              <NA>       <NA>          '                               (diff_add, that )                                (diff_chg, ')            (And now she, ', s trying all she can)   (And now she,  i, s trying all , that , she can)\r\n9    5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>        tir         sl                                 (diff_chg, tir)                               (diff_chg, sl)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)\r\n10   5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>          d         sl                                   (diff_chg, d)                               (diff_chg, sl)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)\r\n11   5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>        tir        epy                                 (diff_chg, tir)                              (diff_chg, epy)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)\r\n12   5     To shoot the sleepy, green-coat man.      To shoot the tired, green-coat man.                                <NA>                             <NA>          d        epy                                   (diff_chg, d)                              (diff_chg, epy)    (To shoot the , sl, e, epy, , green-coat man.)      (To shoot the , tir, e, d, , green-coat man.)\r\n13   6      He cries and screams and runs away;      He cries and screams and runs away;                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN            (He cries and screams and runs away;,)             (He cries and screams and runs away;,)\r\n14   7          The hare runs after him all day          The hare runs after him all day                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN                (The hare runs after him all day,)                 (The hare runs after him all day,)\r\n15   8          The hare runs after him all day       And hears him call out everywhere:  And hears him call out everywhere:  The hare runs after him all day       <NA>       <NA>  (diff_add, And hears him call out everywhere:)  (diff_sub, The hare runs after him all day)                (The hare runs after him all day,)              (And hears him call out everywhere:,)\r\n16   9       And hears him call out everywhere:       And hears him call out everywhere:                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN             (And hears him call out everywhere:,)              (And hears him call out everywhere:,)\r\n17  10  \"Help! Fire! Help! The Hare! The Hare!\"  \"Help! Fire! Help! The Hare! The Hare!\"                                <NA>                             <NA>       <NA>       <NA>                                             NaN                                          NaN        (\"Help! Fire! Help! The Hare! The Hare!\",)         (\"Help! Fire! Help! The Hare! The Hare!\",)\r\n\r\n\r\n\"\"\"\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Compares 2 texts with each other, and returns a Pandas DataFrame",
    "version": "0.11",
    "split_keywords": [
        "string",
        "text",
        "pandas",
        "dataframe",
        "read",
        "difflib",
        "fuzz",
        "fuzzy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b78e9d17efa6a0c684b9859051288634ddabbc4216f06886e7a7027060abf304",
                "md5": "08d104d7bf94e690550fd28e5f909c0d",
                "sha256": "7af68cbe7e436983df610eefafc8f7e8674c11f4c960f3d20e929661df9b475a"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_text_compare-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08d104d7bf94e690550fd28e5f909c0d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12532,
            "upload_time": "2023-04-24T15:44:09",
            "upload_time_iso_8601": "2023-04-24T15:44:09.819517Z",
            "url": "https://files.pythonhosted.org/packages/b7/8e/9d17efa6a0c684b9859051288634ddabbc4216f06886e7a7027060abf304/a_pandas_ex_text_compare-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "87187b30c05770bb7cf5a61d2370077d715f1d61a5b9c8a9e1510d82d8318e17",
                "md5": "95b37c4efd4210270b1ecf23181cf7d5",
                "sha256": "5325a12230b4481f70ac83e7505d5661f54b93b96a555bd2c29921741fc4261a"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_text_compare-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "95b37c4efd4210270b1ecf23181cf7d5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11319,
            "upload_time": "2023-04-24T15:44:13",
            "upload_time_iso_8601": "2023-04-24T15:44:13.380666Z",
            "url": "https://files.pythonhosted.org/packages/87/18/7b30c05770bb7cf5a61d2370077d715f1d61a5b9c8a9e1510d82d8318e17/a_pandas_ex_text_compare-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-24 15:44:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "a_pandas_ex_text_compare",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "a_pandas_ex_bs4df_lite",
            "specs": []
        },
        {
            "name": "flatten_everything",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "regex",
            "specs": []
        }
    ],
    "lcname": "a-pandas-ex-text-compare"
}
        
Elapsed time: 0.07440s