Skip to main content

No project description provided

Project description

Lexoid

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

Motivation:

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

Installation

To install dependencies:

make install

or, to install with dev-dependencies:

make dev

To activate virtual environment:

source .venv/bin/activate

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=""

To build a .whl file for testing:

poetry build

Optionally, to use Playwright for retrieving web content with the .whl package (else regular requests will be used by default):

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

Usage

Example 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=True)
# or
pdf_path = "path/to/immigration-law-advisor.pdf"
parsed_md = parse(pdf_path, parser_type="LLM_PARSE", raw=True)

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".
  • raw (bool, optional): Whether to return raw text or structured data. Defaults to False.
  • 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)

Rank Model/Framework Similarity Time (s)
1 gpt-4o 0.799 21.77
2 gemini-1.5-pro 0.742 15.77
3 gpt-4o-mini 0.721 14.86
4 gemini-1.5-flash 0.702 4.56

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.6.tar.gz (20.0 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.6-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lexoid-0.1.6.tar.gz
Algorithm Hash digest
SHA256 53672d12ba16a556983c821b1fe2b1c432ae3e4481a2e71626245ecb82d6867b
MD5 88b565025947d08f97c3c777ccecb469
BLAKE2b-256 c8c9e636103a5a3cadd089bafb59940aeb826ed00666f150e97c82fead78bd16

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for lexoid-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b33625c039df5b5d3e0fe30b3fe0ca18bd2e62749f723b4f10d21f40e773037f
MD5 55eab39c91eccb5c8042eae313659aa3
BLAKE2b-256 a2f1b496834d144d597aac107f3cc86a908a1d37fb44c6d4701d62a8077976a1

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