Skip to content

serika-dev/serikaromanizer

Repository files navigation

SerikaRomanizer 🌏

An incredibly advanced, local, and offline TypeScript universal romanizer for Japanese, Korean, and Hindi.

Built from scratch to handle some of the hardest linguistic complexities without relying on massive neural networks or cloud APIs.

Features ✨

🇯🇵 Japanese (Powered by internal Jōyō NLP)

  • Contextual Tokenization: Uses kuromoji (a lightweight 17MB dictionary-based morphological analyzer) to parse compound kanji accurately (e.g. 過去形 -> kakokei, not ka-kyo-kei).
  • Particle Tracking: Accurately maps grammatical particles based on sentence context (e.g., as wa, as e, as o).
  • Native Spacing Semantics: Automatically generates human-readable Romaji spacing akin to lyric websites (like Genius.com) by utilizing intelligent Part-of-Speech (POS) heuristics. Auxiliaries attach to verbs, tokens resolve suffixes, and particles stand independently.
  • Sokuon (っ) Handling: Delays processing of double consonants until the tokenization string is fully formed to prevent mid-word gemination breaking.

🇰🇷 Korean (Pure Math Hangul Decomposition)

  • Zero Dependency: Maps all 11,172 possible Korean characters purely mathematically.
  • Accurate Unicode Translation: Breaks down characters computationally by intersecting their Choseong, Jungseong, and Jongseong without arrays of static maps. Full batchim (bottom consonant) support!

🇮🇳 Hindi (Advanced Devanagari Transliteration)

  • Schwa Deletion: Includes an advanced heuristic algorithm to naturally drop the trailing inherent 'a' sound (Schwa) where native speakers omit it (e.g., नमस्ते -> namaste, पसंद -> pasand).
  • Virama & Matra Mapping: Fully supports halants (viramas) perfectly cancelling inherent vowels.

Installation 📦

npm install serikaromanizer

Usage 💡

import { romanize } from "serikaromanizer";

async function run() {
    // 🇯🇵 Japanese
    const jaT = "困っちまうこれは誰かのせい。気付いたら大人になっていた。";
    console.log(await romanize(jaT, "ja"));
    // Output: komacchimau kore wa dareka no sei. kizuitara otona ni natteita.

    // 🇰🇷 Korean
    const koT = "안녕하세요! 흙길을 밟고 지나갔다.";
    console.log(await romanize(koT, "ko"));
    // Output: annyeonghaseyo! heulggileul balbgo jinagassda.

    // 🇮🇳 Hindi
    const hiT = "नमस्ते, आप कैसे हैं? मुझे हिंदी सीखना बहुत पसंद है।";
    console.log(await romanize(hiT, "hi"));
    // Output: namaste, aap kaise hain? mujhe hindii siikhnaa bahut pasand hai।
}

run();

Supported Output Languages:

  • ja: Japanese
  • ko: Korean
  • hi: Hindi

Contributing

Pull requests are welcome! If you are fixing a bug, please include tests demonstrating the previous error.

License

MIT

About

FOSS pure-local omni-romanizer for Japanese, Korean, and Hindi text.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors