Skip to main content

Parser for all.

Project description

🌊 AnyParser

pypi_status Commit activity Slack

AnyParser provides an API to accurately extract unstructured data (e.g., PDFs, images, charts) into a structured format.

:seedling: Set up your AnyParser API key

To get started, generate your API key from the Sandbox Account Page. Each account comes with 100 free pages.

⚠️ Note: The free API is limited to 10 pages/call.

For more information or to inquire about larger usage plans, feel free to contact us at info@cambioml.com.

To set up your API key (CAMBIO_API_KEY), follow these steps:

  1. Create a .env file in the root directory of your project.
  2. Add the following line to the .env file:
CAMBIO_API_KEY=0cam************************

:computer: Installation

1. Set Up a New Conda Environment and Install AnyParser

First, create and activate a new Conda environment, then install AnyParser:

conda create -n any-parse python=3.10 -y
conda activate any-parse
pip3 install any-parser

2. Create an AnyParser Instance Using Your API Key

Use your API key to create an instance of AnyParser. Make sure you’ve set up your .env file to store your API key securely:

import os
from dotenv import load_dotenv
from any_parser import AnyParser

# Load environment variables
load_dotenv(override=True)

# Get the API key from the environment
example_apikey = os.getenv("CAMBIO_API_KEY")

# Create an AnyParser instance
ap = AnyParser(api_key=example_apikey)

3. Run Synchronous Extraction

To extract data synchronously and receive immediate results:

# Extract content from the file and get the markdown output along with processing time
markdown, total_time = ap.extract(file_path="./data/test.pdf")

4. Run Asynchronous Extraction

For asynchronous extraction, send the file for processing and fetch results later:

# Send the file to begin asynchronous extraction
file_id = ap.async_extract(file_path="./data/test.pdf")

# Fetch the extracted content using the file ID
markdown = ap.async_fetch(file_id=file_id)

:scroll: Examples

Check out these examples to see how you can utilize AnyParser to extract text, numbers, and symbols in fewer than 10 lines of code!

Extract all text and layout from PDF into Markdown Format

Are you an AI engineer looking to accurately extract both the text and layout (e.g., table of contents or Markdown headers hierarchy) from a PDF? Check out this 3-minute notebook demo.

Extract a Table from an Image into Markdown Format

Are you a financial analyst needing to accurately extract numbers from a table within an image? Explore this 3-minute notebook example.

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

any_parser-0.0.17.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

any_parser-0.0.17-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file any_parser-0.0.17.tar.gz.

File metadata

  • Download URL: any_parser-0.0.17.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.0 Darwin/23.3.0

File hashes

Hashes for any_parser-0.0.17.tar.gz
Algorithm Hash digest
SHA256 76a6c61ccacd8664b6b68f395cd3e9de563f21e730701f1b3f3a82b8b53c8d92
MD5 1f67726016565f861aeb2f354b4fb997
BLAKE2b-256 e2b496b3045b700008ab438f21fb7b1be15cebd975170200e79368d19cc46006

See more details on using hashes here.

File details

Details for the file any_parser-0.0.17-py3-none-any.whl.

File metadata

  • Download URL: any_parser-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.0 Darwin/23.3.0

File hashes

Hashes for any_parser-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 5624474ce42ee0dd71915b5c8e84099135a806f1f19755e8115e4ea6382803ce
MD5 442f8f93825dce6a74810a5ade8820bc
BLAKE2b-256 c614c03841b4a64feae27903f30fa231827cbb6291e9f924554edca2a9c7d122

See more details on using hashes here.

Supported by

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