spacy2df


Namespacy2df JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/spacy2df
Summaryconverts a spaCy object into a pandas DataFrame
upload_time2023-07-02 06:19:56
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords spacy nlp pandas dataframe
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# converts a spaCy object into a pandas DataFrame

## pip install spacy2df

#### Tested against Windows 10 / Python 3.10 / Anaconda 

	
```python
import spacy
from spacy2df import spacy2df

# Load Spacy model and create a doc object
nlp = spacy.load(pt_core_news_sm)
frase = Rede do Banco Itaú é bom
doc = nlp(frase)

# Convert the doc object to a DataFrame
df = spacy2df(doc, colprefix='aa_')
print(df)

                  aa_dep                    aa_doc aa_ent_id aa_ent_iob aa_ent_kb_id aa_ent_type  aa_has_vector aa_head  aa_is_alpha  aa_is_ascii  aa_is_bracket  aa_is_currency  aa_is_digit  aa_is_left_punct  aa_is_lower  aa_is_oov  aa_is_punct  aa_is_quote  aa_is_right_punct  aa_is_sent_end  aa_is_sent_start  aa_is_space  aa_is_stop  aa_is_title  aa_is_upper aa_lang aa_left_edge aa_lemma  aa_like_email  aa_like_num  aa_like_url aa_lower  aa_n_lefts  aa_n_rights                                                                              aa_morph aa_norm aa_orth aa_pos aa_prefix               aa_rank aa_right_edge                          aa_sent aa_sent_start  aa_sentiment aa_shape aa_suffix aa_tag        aa_ancestors aa_children   aa_lefts aa_rights                       aa_subtree aa_iob_strings morph_Gender morph_Number morph_Definite morph_PronType morph_Mood  morph_Person morph_Tense morph_VerbForm
    0      nsubj  Rede do Banco Itaú é bom                    O                                    True     bom         True         True          False           False        False             False        False       True        False        False              False           False              True        False       False         True        False      pt         Rede     rede          False        False        False     rede           0         True                                                   {'Gender' 'Fem', 'Number' 'Sing'}    rede    Rede  PROPN         R  18446744073709551615          Itaú  (Rede, do, Banco, Itaú, é, bom)         False           0.0     Xxxx       ede  PROPN              (bom,)    (Banco,)         ()  (Banco,)          (Rede, do, Banco, Itaú)    (, I, O, B)          Fem         Sing           NA           NA       NA          NA        NA           NA
    1       case  Rede do Banco Itaú é bom                    O                                    True   Banco         True         True          False           False        False             False         True       True        False        False              False           False             False        False        True        False        False      pt           do     de o          False        False        False       do           0        False            {'Definite' 'Def', 'Gender' 'Masc', 'Number' 'Sing', 'PronType' 'Art'}      do      do    ADP         d  18446744073709551615            do  (Rede, do, Banco, Itaú, é, bom)            -1           0.0       xx        do    ADP  (Banco, Rede, bom)          ()         ()        ()                            (do,)    (, I, O, B)         Masc         Sing            Def            Art       NA          NA        NA           NA
    2       nmod  Rede do Banco Itaú é bom                    B                      LOC           True    Rede         True         True          False           False        False             False        False       True        False        False              False           False             False        False       False         True        False      pt           do    Banco          False        False        False    banco           1         True                                                  {'Gender' 'Masc', 'Number' 'Sing'}   banco   Banco  PROPN         B  18446744073709551615          Itaú  (Rede, do, Banco, Itaú, é, bom)            -1           0.0    Xxxxx       nco  PROPN         (Rede, bom)  (do, Itaú)      (do,)   (Itaú,)                (do, Banco, Itaú)    (, I, O, B)         Masc         Sing           NA           NA       NA          NA        NA           NA
    3  flatname  Rede do Banco Itaú é bom                    I                      LOC           True   Banco         True        False          False           False        False             False        False       True        False        False              False           False             False        False       False         True        False      pt         Itaú     Itaú          False        False        False     itaú           0        False                                                                    {'Number' 'Sing'}    itaú    Itaú  PROPN         I  18446744073709551615          Itaú  (Rede, do, Banco, Itaú, é, bom)            -1           0.0     Xxxx       taú  PROPN  (Banco, Rede, bom)          ()         ()        ()                          (Itaú,)    (, I, O, B)         NA         Sing           NA           NA       NA          NA        NA           NA
    4        cop  Rede do Banco Itaú é bom                    O                                    True     bom         True        False          False           False        False             False         True       True        False        False              False           False             False        False        True        False        False      pt            é      ser          False        False        False        é           0        False  {'Mood' 'Ind', 'Number' 'Sing', 'Person' '3', 'Tense' 'Pres', 'VerbForm' 'Fin'}       é       é    AUX         é  18446744073709551615             é  (Rede, do, Banco, Itaú, é, bom)            -1           0.0        x         é    AUX              (bom,)          ()         ()        ()                             (é,)    (, I, O, B)         NA         Sing           NA           NA        Ind             3        Pres            Fin
    5       ROOT  Rede do Banco Itaú é bom                    O                                    True     bom         True         True          False           False        False             False         True       True        False        False              False            True             False        False        True        False        False      pt         Rede      bom          False        False        False      bom           2        False                                                  {'Gender' 'Masc', 'Number' 'Sing'}     bom     bom    ADJ         b  18446744073709551615           bom  (Rede, do, Banco, Itaú, é, bom)            -1           0.0      xxx       bom    ADJ                  ()   (Rede, é)  (Rede, é)        ()  (Rede, do, Banco, Itaú, é, bom)    (, I, O, B)         Masc         Sing           NA           NA       NA          NA        NA           NA


```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/spacy2df",
    "name": "spacy2df",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "spacy,nlp,pandas,DataFrame",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/17/d0336c628d4d1ad8c6285f975b0e028ec470ad379c2bc2756a261c188472/spacy2df-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# converts a spaCy object into a pandas DataFrame\r\n\r\n## pip install spacy2df\r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\n\t\r\n```python\r\nimport spacy\r\nfrom spacy2df import spacy2df\r\n\r\n# Load Spacy model and create a doc object\r\nnlp = spacy.load(pt_core_news_sm)\r\nfrase = Rede do Banco Ita\u00fa \u00e9 bom\r\ndoc = nlp(frase)\r\n\r\n# Convert the doc object to a DataFrame\r\ndf = spacy2df(doc, colprefix='aa_')\r\nprint(df)\r\n\r\n                  aa_dep                    aa_doc aa_ent_id aa_ent_iob aa_ent_kb_id aa_ent_type  aa_has_vector aa_head  aa_is_alpha  aa_is_ascii  aa_is_bracket  aa_is_currency  aa_is_digit  aa_is_left_punct  aa_is_lower  aa_is_oov  aa_is_punct  aa_is_quote  aa_is_right_punct  aa_is_sent_end  aa_is_sent_start  aa_is_space  aa_is_stop  aa_is_title  aa_is_upper aa_lang aa_left_edge aa_lemma  aa_like_email  aa_like_num  aa_like_url aa_lower  aa_n_lefts  aa_n_rights                                                                              aa_morph aa_norm aa_orth aa_pos aa_prefix               aa_rank aa_right_edge                          aa_sent aa_sent_start  aa_sentiment aa_shape aa_suffix aa_tag        aa_ancestors aa_children   aa_lefts aa_rights                       aa_subtree aa_iob_strings morph_Gender morph_Number morph_Definite morph_PronType morph_Mood  morph_Person morph_Tense morph_VerbForm\r\n    0      nsubj  Rede do Banco Ita\u00fa \u00e9 bom                    O                                    True     bom         True         True          False           False        False             False        False       True        False        False              False           False              True        False       False         True        False      pt         Rede     rede          False        False        False     rede           0         True                                                   {'Gender' 'Fem', 'Number' 'Sing'}    rede    Rede  PROPN         R  18446744073709551615          Ita\u00fa  (Rede, do, Banco, Ita\u00fa, \u00e9, bom)         False           0.0     Xxxx       ede  PROPN              (bom,)    (Banco,)         ()  (Banco,)          (Rede, do, Banco, Ita\u00fa)    (, I, O, B)          Fem         Sing           NA           NA       NA          NA        NA           NA\r\n    1       case  Rede do Banco Ita\u00fa \u00e9 bom                    O                                    True   Banco         True         True          False           False        False             False         True       True        False        False              False           False             False        False        True        False        False      pt           do     de o          False        False        False       do           0        False            {'Definite' 'Def', 'Gender' 'Masc', 'Number' 'Sing', 'PronType' 'Art'}      do      do    ADP         d  18446744073709551615            do  (Rede, do, Banco, Ita\u00fa, \u00e9, bom)            -1           0.0       xx        do    ADP  (Banco, Rede, bom)          ()         ()        ()                            (do,)    (, I, O, B)         Masc         Sing            Def            Art       NA          NA        NA           NA\r\n    2       nmod  Rede do Banco Ita\u00fa \u00e9 bom                    B                      LOC           True    Rede         True         True          False           False        False             False        False       True        False        False              False           False             False        False       False         True        False      pt           do    Banco          False        False        False    banco           1         True                                                  {'Gender' 'Masc', 'Number' 'Sing'}   banco   Banco  PROPN         B  18446744073709551615          Ita\u00fa  (Rede, do, Banco, Ita\u00fa, \u00e9, bom)            -1           0.0    Xxxxx       nco  PROPN         (Rede, bom)  (do, Ita\u00fa)      (do,)   (Ita\u00fa,)                (do, Banco, Ita\u00fa)    (, I, O, B)         Masc         Sing           NA           NA       NA          NA        NA           NA\r\n    3  flatname  Rede do Banco Ita\u00fa \u00e9 bom                    I                      LOC           True   Banco         True        False          False           False        False             False        False       True        False        False              False           False             False        False       False         True        False      pt         Ita\u00fa     Ita\u00fa          False        False        False     ita\u00fa           0        False                                                                    {'Number' 'Sing'}    ita\u00fa    Ita\u00fa  PROPN         I  18446744073709551615          Ita\u00fa  (Rede, do, Banco, Ita\u00fa, \u00e9, bom)            -1           0.0     Xxxx       ta\u00fa  PROPN  (Banco, Rede, bom)          ()         ()        ()                          (Ita\u00fa,)    (, I, O, B)         NA         Sing           NA           NA       NA          NA        NA           NA\r\n    4        cop  Rede do Banco Ita\u00fa \u00e9 bom                    O                                    True     bom         True        False          False           False        False             False         True       True        False        False              False           False             False        False        True        False        False      pt            \u00e9      ser          False        False        False        \u00e9           0        False  {'Mood' 'Ind', 'Number' 'Sing', 'Person' '3', 'Tense' 'Pres', 'VerbForm' 'Fin'}       \u00e9       \u00e9    AUX         \u00e9  18446744073709551615             \u00e9  (Rede, do, Banco, Ita\u00fa, \u00e9, bom)            -1           0.0        x         \u00e9    AUX              (bom,)          ()         ()        ()                             (\u00e9,)    (, I, O, B)         NA         Sing           NA           NA        Ind             3        Pres            Fin\r\n    5       ROOT  Rede do Banco Ita\u00fa \u00e9 bom                    O                                    True     bom         True         True          False           False        False             False         True       True        False        False              False            True             False        False        True        False        False      pt         Rede      bom          False        False        False      bom           2        False                                                  {'Gender' 'Masc', 'Number' 'Sing'}     bom     bom    ADJ         b  18446744073709551615           bom  (Rede, do, Banco, Ita\u00fa, \u00e9, bom)            -1           0.0      xxx       bom    ADJ                  ()   (Rede, \u00e9)  (Rede, \u00e9)        ()  (Rede, do, Banco, Ita\u00fa, \u00e9, bom)    (, I, O, B)         Masc         Sing           NA           NA       NA          NA        NA           NA\r\n\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "converts a spaCy object into a pandas DataFrame",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/spacy2df"
    },
    "split_keywords": [
        "spacy",
        "nlp",
        "pandas",
        "dataframe"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8e5cab8dc449e40e62df27e34019d705bd17e1de312e74b37a7460cb5ce3103",
                "md5": "9c401250eb303d3715308a99f97f0a59",
                "sha256": "3d0658cffa4779e2753e5b75d0c9c5c2e2e3b82296d478654f5f27944336e936"
            },
            "downloads": -1,
            "filename": "spacy2df-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c401250eb303d3715308a99f97f0a59",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9713,
            "upload_time": "2023-07-02T06:19:54",
            "upload_time_iso_8601": "2023-07-02T06:19:54.819721Z",
            "url": "https://files.pythonhosted.org/packages/d8/e5/cab8dc449e40e62df27e34019d705bd17e1de312e74b37a7460cb5ce3103/spacy2df-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b217d0336c628d4d1ad8c6285f975b0e028ec470ad379c2bc2756a261c188472",
                "md5": "946ddaf243490e4a5b54bf3a98320129",
                "sha256": "b594071e8c19a79e140801f0c54d9c5a678a1c530d4eff821b9793548e6aec3f"
            },
            "downloads": -1,
            "filename": "spacy2df-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "946ddaf243490e4a5b54bf3a98320129",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7735,
            "upload_time": "2023-07-02T06:19:56",
            "upload_time_iso_8601": "2023-07-02T06:19:56.881902Z",
            "url": "https://files.pythonhosted.org/packages/b2/17/d0336c628d4d1ad8c6285f975b0e028ec470ad379c2bc2756a261c188472/spacy2df-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-02 06:19:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "spacy2df",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "spacy2df"
}
        
Elapsed time: 0.14673s