converts a spaCy object into a pandas DataFrame
Project description
converts a spaCy object into a pandas DataFrame
pip install spacy2df
Tested against Windows 10 / Python 3.10 / Anaconda
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spacy2df-0.10.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file spacy2df-0.10.tar.gz
.
File metadata
- Download URL: spacy2df-0.10.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b594071e8c19a79e140801f0c54d9c5a678a1c530d4eff821b9793548e6aec3f |
|
MD5 | 946ddaf243490e4a5b54bf3a98320129 |
|
BLAKE2b-256 | b217d0336c628d4d1ad8c6285f975b0e028ec470ad379c2bc2756a261c188472 |
File details
Details for the file spacy2df-0.10-py3-none-any.whl
.
File metadata
- Download URL: spacy2df-0.10-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d0658cffa4779e2753e5b75d0c9c5c2e2e3b82296d478654f5f27944336e936 |
|
MD5 | 9c401250eb303d3715308a99f97f0a59 |
|
BLAKE2b-256 | d8e5cab8dc449e40e62df27e34019d705bd17e1de312e74b37a7460cb5ce3103 |