Skip to main content

paisa-parse

Zero-dependency Hinglish & Indian-English spoken financial entity parser with confidence scores, a confirm-back policy, and drop-in plugins for Pipecat, LiveKit Agents, and MCP.

Turns noisy ASR transcripts into structured Indian financial values:

  • "dedh lakh" -> Decimal("150000"), formatted "₹1,50,000", action="confirm" (high_value_threshold)
  • "paune do hazaar" -> Decimal("1750"), formatted "₹1,750"
  • "nau aath saat chhe paanch chaar teen do ek shunya" -> "9876543210" (subtype="phone")
  • "rahul dot verma at ok icici" -> "rahul.verma@okicici" (validated against ~75 NPCI PSP handles)
  • "IFSC SBIN triple zero ek do teen chaar" -> "SBIN0001234" (RBI structure + bank prefix check + 5th-char O->0 repair)

Installation

Core library (pure Python 3.10+, zero runtime dependencies):

pip install paisa-parse

With optional voice-agent / tool integrations:

pip install "paisa-parse[pipecat]"
pip install "paisa-parse[livekit]"
pip install "paisa-parse[mcp]"
pip install "paisa-parse[all]"

Quickstart

from paisa_parse import ConfirmPolicy, parse

result = parse(
    "bhai rahul dot verma at ok icici pe dedh lakh bhej do",
    policy=ConfirmPolicy.balanced(language="hinglish"),
)

print(result.normalized_text)
# bhai rahul.verma@okicici pe ₹1,50,000 bhej do

for entity in result.entities:
    print(entity.kind.value, entity.value, entity.confidence, entity.action.value)
    if entity.confirm_prompt:
        print("  TTS confirm-back:", entity.confirm_prompt)

Confirm-Back Policy Presets

Voice agents should not blindly execute a ₹1,50,000 transfer or trust an ambiguous ASR token like "ded sau" or "SBINO001234". ConfirmPolicy outputs one of three actions (accept, confirm, reprompt) plus a TTS-ready confirm_prompt in "en-IN" or "hinglish":

  • ConfirmPolicy.balanced() (default): auto-accept >= 0.85, confirm 0.55–0.85 or amounts >= ₹50,000, reprompt < 0.55.
  • ConfirmPolicy.strict(): always confirms upi_id and ifsc, and escalates amounts >= ₹10,000.
  • ConfirmPolicy.permissive(): lower friction (accept >= 0.75, high_value >= ₹5,00,000).

Framework Integrations

1. Pipecat (FrameProcessor)

Place PaisaParseProcessor right after your STT service in a Pipecat pipeline (examples/pipecat_demo.py):

from paisa_parse import ConfirmPolicy
from paisa_parse.integrations.pipecat import PaisaParseProcessor

processor = PaisaParseProcessor(
    policy=ConfirmPolicy.balanced(language="hinglish"),
    mode="annotate",  # "annotate" | "replace" | "callback_only"
)

2. LiveKit Agents (Agent mixin & stt_node hook)

Attach PaisaParseAgentMixin to your livekit.agents.Agent subclass (examples/livekit_demo.py):

from livekit.agents import Agent
from paisa_parse import ConfirmPolicy
from paisa_parse.integrations.livekit import PaisaParseAgentMixin, PaisaParseHook

class HinglishBankingAgent(PaisaParseAgentMixin, Agent):
    def __init__(self) -> None:
        super().__init__()
        self.paisa_hook = PaisaParseHook(
            policy=ConfirmPolicy.strict(language="en-IN"),
            inject_context=True,
        )

3. Model Context Protocol (MCP) Server

Run over stdio:

paisa-parse-mcp

Exposes four tools: tool_parse_financial_text, tool_parse_amount, tool_validate_upi_id, and tool_validate_ifsc_code.

4. CLI

paisa-parse "bhai rahul dot verma at ok icici pe dedh lakh bhej do, IFSC SBIN triple zero ek do teen chaar" --json

Prior Art & Differentiation

NVIDIA NeMo Text Processing provides mature WFST-based Inverse Text Normalization (ITN) for Devanagari Hindi (hi), and is the right tool if you want general-purpose sentence-level WFST normalization inside a NeMo/Riva stack.

paisa-parse targets a distinct, voice-agent-specific gap:

  1. Romanized Hinglish + Mixed Indian-English: handles what Whisper, Deepgram, Sarvam, and Google STT emit in practice (dedh lakh, sava do crore, chhattees hazaar, teen baar shunya, rahul dot verma at ok icici), alongside Devanagari digits/words.
  2. Colloquial Indian Fractions: native support for dedh (1.5), dhai (2.5), sava (+0.25), paune (-0.25), saade (+0.5), aadha (0.5), and paav (0.25) across Indian scales.
  3. Domain Validators: UPI ID parsing with ~75 NPCI PSP handles (and email rejection) plus 11-character IFSC parsing with RBI bank prefixes and 5th-character O -> 0 repair.
  4. Confidence + Confirm-Back Policy: calibrates confidence for ASR ambiguities (oh -> 0, so -> 100, unknown PSP/bank, truncated phone/IFSC) and produces ready-to-speak accept / confirm / reprompt prompts.
  5. Zero-Dependency Portability: pure Python (pip install paisa-parse), sub-millisecond latency, with native Pipecat, LiveKit Agents, and MCP adapters.

Stress-Test Benchmark Results

Evaluated on benchmarks/stress_test.json (130 realistic & adversarial Hinglish financial utterances across 7 categories) using python benchmarks/run_benchmark.py --no-write:

  • Utterance Exact-Match Accuracy: 100.00% (130/130)
  • Entity Precision / Recall / F1: 1.0000 / 1.0000 / 1.0000 (TP=134, FP=0, FN=0)
  • Confirm-Back Policy Accuracy: 100.00% (134 matched entities)
  • Latency: p50 = 0.250 ms, p95 = 0.544 ms, p99 = 0.809 ms
Category Exact / Total Accuracy
colloquial_fractions 25 / 25 100.00%
compound_amounts 20 / 20 100.00%
spoken_digits 20 / 20 100.00%
upi_ids 20 / 20 100.00%
ifsc_codes 15 / 15 100.00%
multi_entity 15 / 15 100.00%
adversarial_negatives 15 / 15 100.00%

Scope note: stress_test.json is an author-curated stress suite (not an external multi-vendor ASR corpus). Real-world audio transcripts with unseen regional spellings or severe acoustic misrecognitions may score lower; contributions of real failure utterances are welcome.


Adoption & Community Status (Honest Reporting)

Current status as of v0.1.0 (pre-publish local release):

  • PyPI Downloads: 0 (package not yet uploaded to PyPI; see PUBLISHING.md for upload steps)
  • GitHub Stars / Open Issues: 0 stars / 0 issues (repository not yet pushed publicly)
  • Pipecat / LiveKit Community Listings: Pending submission (adapters and demos included; community PR/listing links will be added once published)

License

MIT

Metadata

Release files for paisa-parse 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paisa-parse 0.1.0
File Size Uploaded Provenance Actions
paisa_parse-0.1.0.tar.gz 44.9 kB Without provenance Details for paisa_parse-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for paisa-parse 0.1.0
File Interpreter ABI Platform Actions
paisa_parse-0.1.0-py3-none-any.whl Python 3 none any Details for paisa_parse-0.1.0-py3-none-any.whl

Total release size: 83.9 kB

Release files / paisa_parse-0.1.0.tar.gz

Download URL paisa_parse-0.1.0.tar.gz
Size 44.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c536502a00e844395740d97067b38a49ae4fdbdb3557a556cce2b70fede914ce
BLAKE2b-256 checksum
How to use checksums
3d2f068b54e26db1f289cdc119cea9c3f88beaf8a5fc72b648ee22e7655fb3c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / paisa_parse-0.1.0-py3-none-any.whl

Download URL paisa_parse-0.1.0-py3-none-any.whl
Size 39.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5ea785bb211785e62d8913885b75d2e7886f6ed6e5feacc8ff2bdbe00d0de76
BLAKE2b-256 checksum
How to use checksums
cf42b848e9f5bca75cb79df24b8b4e6906ff199b32ac0ef9598006d618dbbc41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for paisa-parse 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page