Skip to main content

AI-powered invoice template extraction library for Tako

Project description

Template Sense

AI-powered invoice template extraction library for structured metadata analysis.

Template Sense analyzes Excel-based invoice templates using heuristics and AI to extract structured metadata, supporting multi-language translation and fuzzy matching against canonical field dictionaries.

Installation

From PyPI (Recommended)

# Latest version
pip install template-sense

# Specific version
pip install template-sense==0.1.0

From GitHub

# Latest release
pip install git+https://github.com/Projects-with-Babajide/template-sense.git@main

# Specific release tag
pip install git+https://github.com/Projects-with-Babajide/template-sense.git@v0.1.0

For Development

git clone https://github.com/Projects-with-Babajide/template-sense.git
cd template-sense
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e .[dev]

Quick Start

from template_sense.analyzer import extract_template_structure

# Define your canonical field dictionary
# This should match YOUR domain's field names
field_dictionary = {
    "headers": {
        "invoice_number": "Invoice number",
        "shipper": "Shipper",
        "consignee": "Consignee",
        "invoice_date": "Invoice date",
        "due_date": "Due date",
    },
    "columns": {
        "product_name": "Product name",
        "quantity": "Quantity",
        "price": "Price",
        "amount": "Amount",
    }
}

# Extract template structure
result = extract_template_structure("path/to/template.xlsx", field_dictionary)

# Access extracted metadata
print(result["normalized_output"]["headers"]["matched"])
print(result["normalized_output"]["columns"]["matched"])

Note: The field_dictionary should contain YOUR canonical field names. Each key is the canonical identifier you want to use, and each value is the expected label in the template. The library will use AI to match similar fields and fuzzy matching to find the best matches.

Features

  • Excel template parsing and analysis
  • AI-based field and column classification (OpenAI & Anthropic)
  • Multi-language translation support
  • Fuzzy matching against canonical field dictionaries
  • Structured JSON output

Documentation

Requirements

  • Python 3.10+
  • OpenAI API key (if using OpenAI provider)
  • Anthropic API key (if using Anthropic provider)

License

MIT

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Support

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

template_sense-0.1.1.tar.gz (174.4 kB view details)

Uploaded Source

Built Distribution

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

template_sense-0.1.1-py3-none-any.whl (122.8 kB view details)

Uploaded Python 3

File details

Details for the file template_sense-0.1.1.tar.gz.

File metadata

  • Download URL: template_sense-0.1.1.tar.gz
  • Upload date:
  • Size: 174.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for template_sense-0.1.1.tar.gz
Algorithm Hash digest
SHA256 469395ff71fa33ea03059fec69a5f2ff7efa2bdd84f12001f3e69bec30732305
MD5 e9b2f646ce65715e81aa02c2c82a71a4
BLAKE2b-256 ccc730140e289f8869dd0ab7908f21ab9cc677cd3d7cb9a02187ba11439b18da

See more details on using hashes here.

Provenance

The following attestation bundles were made for template_sense-0.1.1.tar.gz:

Publisher: release.yml on Projects-with-Babajide/template-sense

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file template_sense-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: template_sense-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 122.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for template_sense-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10170852b158abba257824d5032069331dd19b0fd9388f82089d652398f15058
MD5 a43619181d453e0f4aedc6d2d62b05d3
BLAKE2b-256 a1092641f016b25bc4c3c2fe09f3d1b46ccac127062bb37237a8fefb2deec821

See more details on using hashes here.

Provenance

The following attestation bundles were made for template_sense-0.1.1-py3-none-any.whl:

Publisher: release.yml on Projects-with-Babajide/template-sense

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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