Skip to main content

Policy document classification powered by LLMs

Project description

cat-pol

Policy document classification powered by LLMs. A thin, policy-specific wrapper around cat-stack.

cat-pol adds policy-document-specific prompt framing ("The following is an excerpt from a policy document...") on top of the domain-agnostic cat-stack engine — giving LLMs the context that text comes from policy documents.

Installation

pip install cat-pol

With optional extras:

pip install "cat-pol[pdf]"         # PDF document processing
pip install "cat-pol[embeddings]"  # Embedding-based similarity scoring

Quick Start

Classify policy document excerpts

import cat_pol

results = cat_pol.classify(
    input_data=[
        "The committee voted to approve the rezoning request for parcel 42.",
        "Motion to table the budget amendment until the next session.",
    ],
    categories=["Approval", "Rejection", "Deferral", "Amendment"],
    document_context="City council meeting minutes from March 2026",
    api_key="sk-...",
)

Discover categories from policy text

result = cat_pol.extract(
    input_data=excerpts,
    api_key="sk-...",
    document_context="FOIA request responses regarding environmental compliance",
)
print(result["top_categories"])

Summarize policy documents

summaries = cat_pol.summarize(
    input_data=documents,
    api_key="sk-...",
    description="Legislative bill summaries from the 118th Congress",
)

How It Works

cat-pol is a thin wrapper that:

  1. Takes your document_context parameter
  2. Injects policy-specific framing: "The following is an excerpt from a policy document. Context: {document_context}."
  3. Delegates to cat-stack for all LLM communication, classification logic, batch processing, and ensemble methods

All cat-stack parameters (multi-model ensemble, batch mode, chain-of-thought, etc.) are passed through via **kwargs.

API

Function Description
classify() Classify excerpts into predefined categories
extract() Discover and normalize categories from document text
explore() Raw category extraction (no deduplication)
summarize() Summarize documents (pass-through to cat-stack)

Ecosystem

Package Role
cat-stack Domain-agnostic LLM classification engine
cat-survey Survey response classification
cat-pol Policy document classification (this package)
cat-cog Cognitive assessment scoring (CERAD)

License

GPL-3.0-or-later

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

cat_pol-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

cat_pol-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cat_pol-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.14

File hashes

Hashes for cat_pol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13ff11ce8eda8d11773de20583644dec98c9ec49df538d240748435f1ec429fc
MD5 80df846225bf8745e3294299d09c89d1
BLAKE2b-256 9bbd8b2db39ecf86738c310b3df14648565e08fcdec161ea8789c51214741183

See more details on using hashes here.

File details

Details for the file cat_pol-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cat_pol-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.14

File hashes

Hashes for cat_pol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91d1f9b839e6a22b830676411eb4cb2e8f8fe75a72441079a0c681497074ea58
MD5 aeecaccc98c06fbb284769836e3c462a
BLAKE2b-256 004dce6eaf73d23f2422791435d17fc52b935a7f9fc9aa63d755678ab955bbfb

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