<jupyter_start><jupyter_text>Solve's preprocessing pipeline diagnostic<jupyter_code>from src.preprocessing import CorpusPreprocess
from src import PROJECT_ROOT
import os
from json import load
from string import punctuation
from nltk.corpus import stopwords
with open(os.path.join(PROJECT_ROOT, "tasks/extract_text/output/pdf_files.json")) as file:
    text_pdfs = load(file)
text = text_pdfs['Mexico_CONAFOR_ plan 2025']['Text']
text
spa_stopwords = set(stopwords.words('spanish'))
prep = CorpusPreprocess('spanish', stop_words=spa_stopwords, strip_accents=True, punctuation_list=punctuation)
prep_text = prep.fit_transform([text], tokenize=False)
prep_text<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09606986899563319, 'fraction_numerical': 0.005822416302765648, 'mean_word_length': 9.26865671641791, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '169086', 'license': 'RSA-MD', 'n_tokens_mistral': 237, 'n_tokens_neox': 226, 'n_words': 48, 'path': 'tasks/text_preprocessing/notebooks/old/prep_diagnostic.ipynb', 'repo_name': 'thefirebanks/policy-data-analyzer', 'size': '687'}