Skip to content

kalle07/parsing

Repository files navigation

parsing

only for advanced users
update: 11/25 PDF_Parser-Sevenof9_v7f, cleaner lines (much better handling with hyphen, will be merged on line-end), faster word to text-block algorithm ~20% faster at all.

PDF to TXT converter ready to chunk for your RAG

ONLY WINDOWS
EXE and PY available (en)
exe files aviable on hugging (or relases -> right side):
https://huggingface.co/kalle07/pdf2txt_parser_converter

give me a ❤️, if you like ;)

newest: PDF Parser - Sevenof9_v7f.py

grafik

Most LLM applications only convert your PDF simple to txt, nothing more, its like you save your PDF as txt file. Often textblocks are mixed and tables not readable. Therefore its better to convert it with some help of a parser.
I work with "pdfplumber/pdfminer" none OCR(no images) and the PDF must contain copyable text.

  • 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
  • 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 oc you need to import missing libraries.

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 processes 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. 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"
my raw-txt-snippet extractor
https://github.com/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!

About

only for advanced users

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages