Skip to main content

No project description provided

Project description

Lexoid

Open In Colab GitHub license PyPI Docs

Lexoid is an efficient document parsing library that supports both LLM-based and non-LLM-based (static) PDF document parsing.

Documentation

Motivation:

  • Use the multi-modal advancement of LLMs
  • Enable convenience for users
  • Collaborate with a permissive license

Installation

Installing with pip

pip install lexoid

To use LLM-based parsing, define the following environment variables or create a .env file with the following definitions

OPENAI_API_KEY=""
GOOGLE_API_KEY=""

Optionally, to use Playwright for retrieving web content (instead of the requests library):

playwright install --with-deps --only-shell chromium

Building .whl from source

make build

Creating a local installation

To install dependencies:

make install

or, to install with dev-dependencies:

make dev

To activate virtual environment:

source .venv/bin/activate

Usage

Example Notebook

Example Colab Notebook

Here's a quick example to parse documents using Lexoid:

from lexoid.api import parse
from lexoid.api import ParserType

parsed_md = parse("https://www.justice.gov/eoir/immigration-law-advisor", parser_type="LLM_PARSE")["raw"]
# or
pdf_path = "path/to/immigration-law-advisor.pdf"
parsed_md = parse(pdf_path, parser_type="LLM_PARSE")["raw"]

print(parsed_md)

Parameters

  • path (str): The file path or URL.
  • parser_type (str, optional): The type of parser to use ("LLM_PARSE" or "STATIC_PARSE"). Defaults to "AUTO".
  • pages_per_split (int, optional): Number of pages per split for chunking. Defaults to 4.
  • max_threads (int, optional): Maximum number of threads for parallel processing. Defaults to 4.
  • **kwargs: Additional arguments for the parser.

Benchmark

Initial results (more updates soon)

Note: Benchmarks are currently done in the zero-shot setting.

Rank Model/Framework Similarity Time (s)
1 gpt-4o 0.799 21.77
2 gemini-2.0-flash-exp 0.797 13.47
3 gemini-exp-1121 0.779 30.88
4 gemini-1.5-pro 0.742 15.77
5 gpt-4o-mini 0.721 14.86
6 gemini-1.5-flash 0.702 4.56
7 Llama-3.2-11B-Vision-Instruct (via HF) 0.582 21.74
8 Llama-3.2-11B-Vision-Instruct-Turbo (via Together AI) 0.556 4.58
9 Llama-3.2-90B-Vision-Instruct-Turbo (via Together AI) 0.527 10.57
10 Llama-Vision-Free (via Together AI) 0.435 8.42

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lexoid-0.1.9.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lexoid-0.1.9-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file lexoid-0.1.9.tar.gz.

File metadata

  • Download URL: lexoid-0.1.9.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-53-generic

File hashes

Hashes for lexoid-0.1.9.tar.gz
Algorithm Hash digest
SHA256 79f31fe772a0502d6859c491a4a122bb75ba636d2bdf8accdbe3c9922740906d
MD5 d1fd84548aae589e28122ecc328d314d
BLAKE2b-256 3ea97c2edd02e767e6099067549efeb96c80794cc7a9110fed2ef4ef0dd42aeb

See more details on using hashes here.

File details

Details for the file lexoid-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: lexoid-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-53-generic

File hashes

Hashes for lexoid-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 5fda831127786a5097d585a75904a3fad5fdf73e9d5eea70a0904bb23c5b76c3
MD5 faee9a84924fbc41f47a434accf2718c
BLAKE2b-256 ead540ae86d25edd9b5181568957d6764eeb4e8de5cec007ad7f34f410f3c6d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page