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.0.tar.gz (165.3 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.0-py3-none-any.whl (117.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: template_sense-0.1.0.tar.gz
  • Upload date:
  • Size: 165.3 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.0.tar.gz
Algorithm Hash digest
SHA256 2667f0666d1b331e8aca330ec7ba98095e32114e0fb2ee4256156b10dc388262
MD5 f09f1040682e98eb2c8b204f713c5faf
BLAKE2b-256 101580afc01d50c00460783aeaccc894e185cfb00e612ccba2cbba8a822d616d

See more details on using hashes here.

Provenance

The following attestation bundles were made for template_sense-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: template_sense-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 117.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37d180ec6d1a412f13ea1cab49afde0583d5790730afe5b51b3baebce400e546
MD5 2743b645fdd0d1aac77678875dcc7447
BLAKE2b-256 7042898f8a755939d9931953525d4c91695c8c54bdee5a8932a19992a0e6a351

See more details on using hashes here.

Provenance

The following attestation bundles were made for template_sense-0.1.0-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