<jupyter_start><jupyter_text>Bereiten wir das Script vor<jupyter_code>#Imports
import os
import progressbar
import textract
import pandas as pd
#Vorbereitung
pdfs = os.listdir('pdfs')
bar = progressbar.ProgressBar()
lst = []
#Rohe Analyse
for pdf,i in zip(pdfs, bar(range(len(pdfs)))):
    try:
        text = textract.process("pdfs/"+pdf, method='pdfminer', encoding='ISO-8859-1')
        text = text.decode("ISO-8859-1").replace("\n", " ")
        if len(text) < 40:
            text = textract.process("pdfs/"+pdf, method='tesseract', language='deu')
            text = text.decode("ISO-8859-1").replace("\n", " ")
            
        mini_dict = {'Text':text,
                     'File':pdf}
        lst.append(mini_dict)
    except:
        mini_dict = {'Text':'Fehlermeldung',
                     'File':pdf}
        lst.append(mini_dict)
#Erste Säuberung
df = pd.DataFrame(lst)
def date(elem):
    elem = elem[3:11]
    return elem
df['date'] = df['File'].apply(date)
df['date'] = pd.to_datetime(df['date'], format='%Y%m%d')
df.index = df['date']
#Suchen wir noch nach Implantaten
df['implant'] = df['Text'].str.contains('implant')
df.to_csv('datafile.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17543859649122806, 'fraction_numerical': 0.01670843776106934, 'mean_word_length': 3.3093525179856114, 'pattern_counts': {'":': 0, '<': 6, '<?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': '513400', 'license': 'MIT', 'n_tokens_mistral': 443, 'n_tokens_neox': 424, 'n_words': 78, 'path': '15 Debugging, Text, Server/04 Arbeiten wir auf unserem Server mit den Dokumenten.ipynb', 'repo_name': 'edzardschade/Edzard_CAS', 'size': '1197'}