PDF to TXT converter ready to chunck for your RAG
ONLY WINDOWS
EXE and PY available (en and german)
better input = better output
- PDF Parser - Sevenof9_v7f.exe - EXE GUI
- PDF Parser - Sevenof9_v7f.py - Python, you need import libs
- docling_by_sevenof9_v1.py - Python, you need nvidia RTX to run it fast
all other older versions
⇨ give me a ❤️, if you like ;)
DOWNLOAD: "PDF Parser - Sevenof9_v7f.exe" or PDF "Parser - Sevenof9_v7f.py" or "docling_by_sevenof9_v1.py" (read below)
...
Most LLM applications only convert your PDF simple to txt, nothing more, its like you save your PDF as txt file. For usual flowing text Books its quite okay! But often blocks of text that are close together are mixed up and tables cannot be read logically.
Therefore its better to convert it with some help of a "Parser". The embedder can now find a better context.
I work with "pdfplumber/pdfminer" none OCR, so its very fast!
- Works with single and multi PDF list, works with folder
- Intelligent multiprocessing ~10-20 pages per second
- Error tolerant, that means if your PDF is not convertible, it will be skipped, no special handling
- Instant view of the result, hit one pdf on top of the list
- Removes about 5% of the margins around the page
- Converts some common tables as json inside the txt file
- Add the absolute PAGE number to each page
- Add the tag “chapter” or “important” to large and/or bold font.
- All txt files will be created in original folder of PDF, same name as *.txt
- All txt files will be overwritten if you start converting with same PDF
- If there are many text blocks on a page, it may be that text blocks that you would read first appear further down the page. (It is a compromise between many layout options)
- Small blocks of text (such as units or individual numbers), usually near diagrams and sketches, appear at the end of each page
- I advise against using a PDF file directly for RAG formatting (embedding), as you never know how it will look, and incorrect input can lead to poor results
- aprox 5 to 20 Pages/sec - depends on complexity and system-power
- tested on 300 PDF files ~30000 pages
This I have created with my brain and the help of chatGPT, Iam not a coder... sorry so I will not fulfill any wishes unless there are real errors.
It is really hard for me with GUI and the Function and in addition to compile it.
For the python-file you need to import missing libraries.
Of course there is a lot of need for optimization(save/error-handling) or the use of other parser libraries, but it's a start.
i am working on a 50% faster version. in addition, the GUI should allow more influence on the processing, e.g. faster raw text, trim margins (yes/no) and set % yourself, set unimportant text block size, layout with line breaks or force more continuous text. preview on first 10 pages with generated images what is detected with border arround text and tables
Give me a hand if you can ;)
...
I also have a "docling" parser with OCR (GPU is need for fast processing), its only be a python-file, not compiled.
You have to download all libs, and if you start (first time) internal also OCR models are downloaded. At the moment i have prepared a kind of multi docling, the number of parallel processed PDFs depend on VRAM and if you use OCR only for tables or for all. I have set VRAM = 16GB (my GPU RAM, you should set yours) and the multiple calls for docling are VRAM/1.3, so it uses ~12GB (in my version) and processes 12 PDFs at once, only txt and tables are converted, so no images no diagrams (to process pages in parallel its to complicate). For now all PDFs must be same folder like the python file. If you change OCR for all the VRAM consum is rasing you have to set 1.3 to 2 or more.
now have fun and leave a comment if you like ;)
on discord "sevenof9"
maybe of interest:
a txt snippet generator if you cant use an embedder or you need exact character-match
https://huggingface.co/kalle07/raw-txt-snippet-creator
my embedder collection:
https://huggingface.co/kalle07/embedder_collection
I am not responsible for any errors or crashes on your system. If you use it, you take full responsibility!
