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

@piraisoodan/tanglish

v0.1.2

Published

Offline transliteration engine for Indian languages - Tamil (Tanglish), Hindi (Hinglish), Malayalam (Manglish), Telugu (Tenglish)

Downloads

371

Readme

@piraisoodan/tanglish

A high-performance, offline transliteration engine for the Tamil language.

License: MIT

Features

  • Offline-first: Zero latency, no API keys required.
  • Hybrid Engine: Combines Dictionary Lookup (Targeted Learning) with Phonetic Trie (Smart Guessing).
  • Blazing Fast: 10 Million chars/sec throughput (<0.01ms latency).
  • Smart Context: Handles n vs nd, l vs zh correctly.
  • Trainable: Includes tools to scrape, analyze, and "teach" the engine new words.
  • Editor Agnostic: Works with any text editor, framework, or runtime.

🧠 How it Works: Guessing vs Training

Tanglish uses a Hybrid Architecture to achieve high accuracy:

  1. Explicit Training (The Brain):

    • Common words (vanakkam, nandri) are stored in a specialized dictionary (src/data/ta_common.json).
    • Result: 100% Accuracy for trained words.
  2. Smart Guessing (The Intuition):

    • For unknown words, it uses a Phonetic Trie (Prefix Tree) to "guess" the transliteration based on 600+ linguistic rules.
    • Result: High accuracy for names, places, and new vocabulary.

🚀 Making it Smarter (Training)

You can "teach" the engine new vocabulary using our Data Engineering pipeline.

1. Scrape Data (The Textbook)

Collect real-world sentences from Wikipedia, Literature, and Stories to use as a "Test Paper".

# Collect 500 random Tamil articles
bun run tools/scraper/index.ts

2. Analyze Coverage (The Exam)

Check how well the dictionary knows the new words.

bun run tools/analyze_coverage.ts

Output:

🎯 Coverage Analysis:
   - Known Words Found: 322
   - Coverage Rate: 4.5%
📝 Top Missing Words:
   - oru (count: 98) -> Add to Dictionary!

3. Train (Graduation)

Add the missing words to src/data/ta_common.json. Now the engine will never get them wrong again!


Installation

# npm
npm install @piraisoodan/tanglish

# bun
bun add @piraisoodan/tanglish

# yarn
yarn add @piraisoodan/tanglish

Quick Start

import { getSuggestions, transliterate } from "@piraisoodan/tanglish";

// Simple transliteration
const tamil = transliterate("vanakkam");
console.log(tamil); // வணக்கம்

// Get suggestions for autocomplete
const suggestions = getSuggestions("van", 5);
console.log(suggestions);
// [
//   { tanglish: 'vanakkam', tamil: 'வணக்கம்' },
//   { tanglish: 'vandein', tamil: 'வந்தேன்' },
//   ...
// ]

API Reference

transliterate(text: string): string

Transliterate romanized text to Tamil script.

import { transliterate } from "@piraisoodan/tanglish";

transliterate("nandri"); // நன்றி
transliterate("eppadi irukka"); // எப்படி இருக்க
transliterate("coffee kudikkalama"); // காபி குடிக்கலாமா

getSuggestions(query: string, limit?: number): TanglishSuggestion[]

Get dictionary suggestions for autocomplete.

import { getSuggestions } from "@piraisoodan/tanglish";

const suggestions = getSuggestions("nan", 5);
// Returns words starting with 'nan' from dictionary

createTamilEngine(): TransliterationEngine

Create a dedicated engine instance.

import { createTamilEngine } from "@piraisoodan/tanglish";

const engine = createTamilEngine();
engine.transliterate("vanakkam");
engine.getSuggestions("van", 10);
engine.containsTargetScript("வணக்கம்"); // true

containsTamil(text: string): boolean

Check if text contains Tamil characters.

import { containsTamil } from "@piraisoodan/tanglish";

containsTamil("வணக்கம்"); // true
containsTamil("hello"); // false

Dictionary Coverage

The library includes 1000+ curated Tamil words across categories:

| Category | Examples | | -------------- | -------------------------------------- | | Greetings | vanakkam, nandri | | Family | amma, appa, akka, anna, thambi | | Food | saapadu, dosai, idli, sambar, biriyani | | Time | inniki, naalaikki, ippo, maalai | | Verbs | paaru, sollu, kelu, saapdu, thoongu | | Emotions | santosham, kovam, semma, gethu | | Technology | computer, mobile, wifi, whatsapp | | Numbers | onnu, rendu, moonu, pathu |

Advanced Usage

Custom Language Configuration

import { createEngine, type LanguageConfig } from "@piraisoodan/tanglish";

const customConfig: LanguageConfig = {
  id: "custom-tamil",
  name: "Custom Tamil",
  nativeName: "தமிழ்",
  unicodeRange: [0x0B80, 0x0BFF],
  dictionary: {
    "hello": "ஹலோ",
    // ... your custom mappings
  },
  mappings: [
    // Custom phonetic rules
  ],
};

const engine = createEngine(customConfig);

Direct Dictionary Access

import { DICTIONARY } from "@piraisoodan/tanglish";

console.log(DICTIONARY["vanakkam"]); // வணக்கம்

Editor Integrations

Compatibility

| Runtime | Support | | ----------- | ------- | | Node.js 18+ | ✅ | | Bun | ✅ | | Deno | ✅ | | Browser | ✅ |

| Bundler | Support | | ------- | ------- | | Vite | ✅ | | Webpack | ✅ | | Rollup | ✅ | | esbuild | ✅ |

Development

# Clone
git clone https://github.com/desingh-rajan/tanglish.git
cd tanglish

# Install dependencies
bun install

# Run tests
bun test

# Build
bun run build

Contributing

Contributions are welcome! See ARCHITECTURE.md for details on the project structure.

License

MIT © Piraisoodan Team

Related Projects