How camelot-dev/camelot works
Camelot is a Python library and CLI for turning PDF tables into pandas-backed tables and export files. The main workflow accepts a PDF or in-memory input, resolves pages, dispatches a parser, and returns extracted tables for inspection or export. Parser choices cover ruled, whitespace-based, alignment-based, hybrid, and neural structure detection; image conversion and line processing support visual analysis. The README documents these capabilities, while unsampled implementation details are represented cautiously rather than treated as inspected.
Main entry points: handlers.py Parser dispatch · lattice.py Lattice parser · core.py Tables and list · io.py Read API
Components 20
Extraction orchestration
- PDF handler
camelot/handlers.py - Parser dispatch
camelot/handlers.py - Image conversion
camelot/backends/image_conversion.py - Render backends
camelot/backends/pdfium_backend.py
Table parsing
- Parser base
camelot/parsers/base.py - Lattice parser
camelot/parsers/lattice.py - Stream parser
camelot/parsers/stream.py - Network parser
camelot/parsers/network.py - Hybrid parser
camelot/parsers/hybrid.py - ML parser
camelot/parsers/ml.py - Line processing
camelot/image_processing.py
Results and output
- Tables and list
camelot/core.py - Export formats
camelot/core.py - Visual plotting
camelot/plotting.py
Other components
- User
- PDF input
- pandas
- OCR engine
Connections 26
- User → Read API: calls
README.md - User → CLI: runs
README.md - PDF input → Read API: supplies
README.md - Read API → PDF handler: creates handler
camelot/io.py - PDF handler → Parser dispatch: parses pages
camelot/handlers.py - Parser dispatch → Lattice parser: selects parser
camelot/handlers.py - Parser dispatch → Stream parser: selects parser
README.md - Parser dispatch → Network parser: selects parser
README.md - Parser dispatch → Hybrid parser: selects parser
README.md - Parser dispatch → ML parser: selects parser
README.md - Lattice parser → Parser base: extends
camelot/parsers/lattice.py - Stream parser → Parser base: extends
camelot/parsers/stream.py - Network parser → Parser base: extends
camelot/parsers/network.py - Hybrid parser → Lattice parser: combines parser
README.md - Hybrid parser → Network parser: combines parser
README.md - Lattice parser → Line processing: detects lines
camelot/parsers/lattice.py - Lattice parser → Image conversion: renders page
camelot/parsers/lattice.py - Image conversion → Render backends: selects backend
camelot/backends/image_conversion.py - ML parser → Image conversion: renders page
README.md - ML parser → OCR engine: reads scan text
README.md - Parser dispatch → Tables and list: returns tables
camelot/handlers.py - Read API → Tables and list: returns list
camelot/io.py - Tables and list → pandas: provides DataFrame
README.md - Tables and list → Export formats: exports
README.md - Tables and list → Visual plotting: plots tables
- CLI → Read API: exposes extraction
README.md