Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PhantomInsights/mexican-government-report
/ functions
Functions
13 in github.com/PhantomInsights/mexican-government-report
⨍
Functions
13
◇
Types & classes
0
↓ 1 callers
Function
clean_word
Cleans the word by replacing non-friendly characters. Parameters ---------- word : str The word to be cleaned. Returns -
scripts/step3.py:193
↓ 1 callers
Function
extract_text
Read the PDF contents and extract the text that we need.
scripts/step1.py:34
↓ 1 callers
Function
get_entities
Get the entities and save them to .csv Parameters ---------- doc : spacy.doc A doc object.
scripts/step2.py:56
↓ 1 callers
Function
get_sentences
Get the sentences, score and save them to .csv You will require to download the dataset (zip) from the following url: https://www.kaggle.com
scripts/step2.py:75
↓ 1 callers
Function
get_tokens
Get the tokens and save them to .csv Parameters ---------- doc : spacy.doc A doc object.
scripts/step2.py:33
↓ 1 callers
Function
main
Loads the model and processes it. The model used can be installed by running this command on your CMD/Terminal: python -m spacy download
scripts/step2.py:10
Function
get_entity_counts
Gets the number of counts per entity. Parameters ---------- df : pandas.DataFrame The DataFrame to be analyzed.
scripts/step3.py:109
Function
get_state_counts
Gets the number of counts per state. Parameters ---------- df : pandas.DataFrame The DataFrame to be analyzed.
scripts/step3.py:126
Function
get_word_counts
Gets the total word count and the total unique lemmas. Parameters ---------- df : pandas.DataFrame The DataFrame to be analyzed.
scripts/step3.py:63
Function
plot_donut
Generates a donut plot with the counts of 3 categories. Parameters ---------- df : pandas.DataFrame The DataFrame to be plotted.
scripts/step3.py:242
Function
plot_map
Generates a map using the state counts. You will require to download the following file and extract its contents to a folder named: mexicostates
scripts/step3.py:153
Function
plot_most_used_words
Generates a bar plot with the counts of the most used lemmas. Parameters ---------- df : pandas.DataFrame The DataFrame to be plo
scripts/step3.py:83
Function
plot_sentiment_analysis
Generates a bar plot with the sentiment scores of each sentence. Parameters ---------- df : pandas.DataFrame The DataFrame to be
scripts/step3.py:214