npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spoken-number-normalizer

v1.0.0

Published

A high-performance, matcher-based normalization engine for converting spoken or written number expressions into structured numeric values — with **first-class support for the Indian numbering system**.

Readme

spoken-number-normalizer

A high-performance, matcher-based normalization engine for converting spoken or written number expressions into structured numeric values — with first-class support for the Indian numbering system.

Designed for Speech-to-Text (STT) pipelines, streaming workloads, and large-scale data processing.


📚 Table of Contents


Introduction

spoken-number-normalizer is a deterministic normalization engine built specifically for converting spoken numeric expressions into structured numeric values, with native support for Indian units such as lakh and crore.

Unlike regex-heavy solutions, this library is designed to be stream-safe, confidence-aware, and resilient to noisy STT output—making it suitable for production voice systems.


✨ Features

  • Indian Number System Support

    • Native handling of units like lakh and crore
    • Example:
      one crore two lakh five10200005
  • Matcher-Based Architecture

    • Deterministic matchers instead of brittle regular expressions
    • Better handling of nested and long numeric expressions
  • Confidence Scoring

    • Each normalization returns a confidence score
    • Useful for rejecting or flagging low-quality STT transcripts
  • Performance First
    • Tree-shakable ESM and CJS builds
    • Zero runtime dependencies

📦 Installation

npm install spoken-number-normalizer

🚀 Quick Start

JavaScript

import { normalizeNumber } from "spoken-number-normalizer";

const result = normalizeNumber("one crore two lakh five");

console.log(result);
/*
{
  output: 10200005,
  confidence: 0.97
}
*/

🧠 API

normalizeNumber(input: string)

Normalizes a spoken number string into a structured object.

Interface

interface NormalizationResult {
  input: string;
  output?: number;
  confidence: number;
  error?: {
    code: string;
    message: string;
  };
}

🧩 Architecture Overview

The engine follows a linear pipeline to ensure speed and predictability:

  1. Unicode Normalization
    Standardizes character encoding.

  2. Text Cleanup
    Removes fillers and linguistic noise.

  3. Scanner
    Tokenizes the string using a dictionary-based approach.

  4. Matcher Engine

    • Number Matcher (active)
    • Currency Matcher (in development)
  5. Best Match Selection
    Weights competing parses based on confidence.

  6. Structured Output
    Returns the final numeric value.

🤔 Why not regex?

Regex-based normalization solutions often:

  • Break on long or complex numeric strings
  • Fail to express grammar or handle nested units
    (e.g. "one hundred two crore")
  • Are not stream-safe, requiring the full string to be present in memory
  • Cannot provide confidence scores for noisy STT data

This library uses deterministic matchers, making it robust enough for production-grade voice applications.

🛣 Roadmap

  • [ ] Currency normalization (INR, USD, etc.)
  • [ ] Date and time expression parsing
  • [ ] Percentage handling
  • [ ] STT filler removal ("uh", "actually", "yaani")

📜 License

ISC