Skip to content

About

Text preprocessing SDK for TTS - convert text to speech-friendly format

Topics

Resources

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Latest commit

 

History

245 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typecast Autotag

Text preprocessing SDK for TTS — convert text to speech-friendly format

Node.js TypeScript Zero Dependencies License

Features • Installation • Quick Start • API • Tags

한국어 문서


Language Support

The JavaScript and browser package accepts every SSFM v3.0 TTS language:

Language tier Status Language codes
Korean (한국어) ✅ Full patterns ko, kor
English ✅ Full patterns en, eng
Japanese (日本語) ✅ Core TTS patterns ja, jpn
Simplified Chinese (简体中文) ✅ Core TTS patterns zh, zho
Traditional Han-script voices ✅ Core TTS patterns zh-TW, nan, yue
Other SSFM v3.0 languages ✅ Common TTS patterns (31) ISO 639-3 codes below

Official SSFM v3.0 language codes (37): ara, ben, bul, ces, dan, deu, ell, eng, fin, fra, hin, hrv, hun, ind, ita, jpn, kor, msa, nan, nld, nor, pan, pol, por, ron, rus, slk, spa, swe, tam, tgl, tha, tur, ukr, vie, yue, zho.

For the 31 languages without a dedicated rule module, auto-tagging handles datetime, date, time, money, phone, percentage, range, unit, serial, and number patterns. It uses locale-specific date order, month names, currency names, decimal separators, 12/24-hour conventions, and common native digit scripts. Manual tags add name, digits, and account. Ambiguous numbers joined to grammatical ordinal or case suffixes remain unchanged so a cardinal rewrite does not damage pronunciation. The nan and yue codes reuse the Traditional Chinese pattern pipeline while retaining their own TTS voice selection.

All 37 official codes are currently exposed by the JavaScript and browser package. The native C, Python, and Java bindings retain their existing Korean and English entry points.

Supported Environments

Development Languages

Language Version Package
Node.js ≥18 @neosapience/typecast-autotag (npm/pnpm)
Browser Modern @neosapience/typecast-autotag (ESM/UMD)
Python ≥3.11 typecast-autotag (pip)
Java ≥8 typecast-autotag (Maven)
C/C++ Any Native library

Server Platforms

Platform Status
Linux ✅ Supported (CentOS 6.9+, Amazon Linux 2+, Ubuntu, Debian, etc.)
macOS ✅ Supported (Intel & Apple Silicon)
Windows ✅ Supported (Windows 10+)

Server Architectures

Architecture Status
x86_64 (AMD64) ✅ Supported
x86 (32-bit) ✅ Supported
arm64 (AArch64) ✅ Supported
armv7 (32-bit ARM) ✅ Supported

Transform numbers and language-specific patterns into natural speech text. Built for Typecast TTS API and AICC (AI Contact Center) environments.

import { autoTag } from '@neosapience/typecast-autotag';

// English auto-tagging
autoTag('Call me at 555-123-4567 tomorrow.', { language: 'en' });
// → 'Call me at five five five, one two three, four five six seven tomorrow.'

// Korean auto-tagging
autoTag('전화번호는 010-1234-5678입니다.', { language: 'ko' });
// → '전화번호는 공 . 일 . 공 . 일 . 이 . 삼 . 사 . 오 . 육 . 칠 . 팔 입니다.'

// Japanese auto-tagging
autoTag('受付は6–9時、料金は¥12,800です。', { language: 'ja' });
// → '受付はろくじからくじ、料金はいちまんにせんはっぴゃくえんです。'

// Simplified Chinese auto-tagging
autoTag('客服时间是6–9点,费用是¥12,800。', { language: 'zh' });
// → '客服时间是六点到九点,费用是一万二千八百元。'

// Taiwan Mandarin auto-tagging
autoTag('客服時間是6–9點,費用是NT$12,800。', { language: 'zh-TW' });
// → '客服時間是六點到九點,費用是一萬二千八百新臺幣。'

// Spanish common numeric patterns (official ISO 639-3 code)
autoTag('Total 1,234.5 and 72.5%.', { language: 'spa' });
// → 'Total mil doscientos treinta y cuatro punto cinco and setenta y dos punto cinco%.'

Features

  • 37 TTS Languages: Accepts every SSFM v3.0 ISO 639-3 language code, plus existing short aliases.
  • Auto-tagging: Automatically detects and converts patterns like phone numbers, dates, times, and amounts.
  • Manual-tagging: Explicitly tag text with tagName(value) syntax for precise control.
  • Zero Dependencies: Lightweight, fast, and tree-shakeable. Supports both ESM and CommonJS.

Installation

Install from npm:

# pnpm (recommended)
pnpm add @neosapience/typecast-autotag

# npm
npm install @neosapience/typecast-autotag

# yarn
yarn add @neosapience/typecast-autotag

You can still install directly from GitHub for unreleased branches, tags, or commits:

# Install specific branch
pnpm add git+https://github.com/neosapience/typecast-autotag.git#branch-name

# Install specific tag/version
pnpm add git+https://github.com/neosapience/typecast-autotag.git#v1.5.0

# Install specific commit
pnpm add git+https://github.com/neosapience/typecast-autotag.git#commit-hash

Quick Start

English Text Processing

import { autoTag, manualTag, autoTagWithManual } from '@neosapience/typecast-autotag';

// Auto-tagging - automatically detects patterns (English)
autoTag('Call me at 555-123-4567.', { language: 'en' });
// → 'Call me at five five five, one two three, four five six seven.'

autoTag('The meeting is at 2:30 PM.', { language: 'en' });
// → 'The meeting is at two thirty PM.'

autoTag('Total is $1,500.', { language: 'en' });
// → 'Total is one thousand five hundred dollars.'

// Manual-tagging - explicit control
manualTag('Hello, name(John Smith).', { language: 'en' });
// → 'Hello, J O H N S M I T H.'

manualTag('month(12) day(25) is Christmas.', { language: 'en' });
// → 'December twenty-fifth is Christmas.'

Korean Text Processing

import { autoTag, manualTag, autoTagWithManual } from '@neosapience/typecast-autotag';

// Auto-tagging - automatically detects patterns (Korean)
autoTag('전화번호는 010-1234-5678입니다.', { language: 'ko' });
// → '전화번호는 공 . 일 . 공 . 일 . 이 . 삼 . 사 . 오 . 육 . 칠 . 팔 입니다.'

autoTag('회의는 14:30에 시작합니다.', { language: 'ko' });
// → '회의는 오후 두 시 삼십 분 에 시작합니다.'

autoTag('총 금액은 50000원입니다.', { language: 'ko' });
// → '총 금액은 오만 원 입니다.'

// Manual-tagging - explicit control
manualTag('안녕하세요, name(김철수)님.', { language: 'ko' });
// → '안녕하세요, 김 . 철 . 수님.'

// Combined - use both together
autoTagWithManual('name(김철수)님, 010-1234-5678로 연락주세요.', { language: 'ko' });
// → '김 . 철 . 수 님, 공 . 일 . 공 . 일 . 이 . 삼 . 사 . 오 . 육 . 칠 . 팔 로 연락주세요.'

Japanese Text Processing

import { autoTag, manualTag } from '@neosapience/typecast-autotag';

autoTag('予約日は2026年7月14日、会議は14:30です。', { language: 'ja' });
// → '予約日はにせんにじゅうろくねんしちがつじゅうよっか、会議はじゅうよじさんじゅっぷんです。'

autoTag('スコアは3-2、進捗は72.5%です。', { language: 'ja' });
// → 'スコアはさんたいに、進捗はななじゅうにてんごパーセントです。'

autoTag('東京→大阪、資料は3〜5ページです。', { language: 'ja' });
// → '東京から大阪、資料はさんページからごページです。'

manualTag('暗証番号はdigits(2048)、金額はmoney(5000円)です。', { language: 'ja' });
// → '暗証番号はに・ゼロ・よん・はち、金額はごせんえんです。'

Simplified Chinese Text Processing

import { autoTag, manualTag } from '@neosapience/typecast-autotag';

autoTag('预约日期是2026年7月14日,会议14:30开始。', { language: 'zh' });
// → '预约日期是二零二六年七月十四日,会议十四点三十分开始。'

autoTag('最终比分是3-2,当前进度是72.5%。', { language: 'zh' });
// → '最终比分是三比二,当前进度是百分之七十二点五。'

autoTag('北京→上海,今晚阅读第3至5页。', { language: 'zh' });
// → '北京到上海,今晚阅读第三页到五页。'

manualTag('验证码是digits(2048),总计money(5000元)。', { language: 'zh' });
// → '验证码是二·零·四·八,总计五千元。'

Taiwan Mandarin Text Processing

import { autoTag, manualTag } from '@neosapience/typecast-autotag';

autoTag('手機號碼是0912-345-678,郵遞區號是10617。', { language: 'zh-TW' });
// → '手機號碼是零·九·一·二、三·四·五、六·七·八,郵遞區號是一·零·六·一·七。'

autoTag('訂單編號是AB-2048,航班號是BR108。', { language: 'zh-TW' });
// → '訂單編號是A·B、二·零·四·八,航班號是B·R·一·零·八。'

autoTag('請讀約翰福音3:16,總計NT$1,280。', { language: 'zh-TW' });
// → '請讀約翰福音三章十六節,總計一千二百八十新臺幣。'

manualTag('驗證碼是digits(2048),總計money(5000新臺幣)。', { language: 'zh-TW' });
// → '驗證碼是二·零·四·八,總計五千新臺幣。'

Direct Language Module Access

// Use English module directly
import { english } from '@neosapience/typecast-autotag';

english.autoTag('Call 555-123-4567');
// → 'Call five five five, one two three, four five six seven'

// Use Korean module directly
import { korean } from '@neosapience/typecast-autotag';

korean.autoTag('010-1234-5678');
// → '공 . 일 . 공 . 일 . 이 . 삼 . 사 . 오 . 육 . 칠 . 팔'

// Use Japanese module directly
import { japanese } from '@neosapience/typecast-autotag';

japanese.autoTag('電話番号は090-1234-5678です。');
// → '電話番号はゼロ・きゅう・ゼロ、いち・に・さん・よん、ご・ろく・なな・はちです。'

// Use Simplified Chinese module directly
import { chinese } from '@neosapience/typecast-autotag';

chinese.autoTag('手机号是138-0013-8000。');
// → '手机号是一·三·八、零·零·一·三、八·零·零·零。'

// Use Taiwan Mandarin module directly
import { taiwaneseMandarin } from '@neosapience/typecast-autotag';

taiwaneseMandarin.autoTag('手機號碼是0912-345-678。');
// → '手機號碼是零·九·一·二、三·四·五、六·七·八。'

Voice agents

Create one JavaScript/browser session per conversation. Its language and configuration are copied at creation, so changing the global default cannot affect another call.

import { createVoiceAgent } from '@neosapience/typecast-autotag';

const speech = createVoiceAgent({
  language: 'ko',
  pronunciations: { Typecast: '타입캐스트' },
});

speech.normalize('인증번호는 001234입니다.'); // Reads every digit, including leading zeroes.
speech.normalize('3/4에 예약되었습니다.'); // Preserves 3/4 for clarification.
speech.push('가격은 12,'); // '' — wait for the rest of the amount.
speech.push('500원입니다. '); // '가격은 일만이천오백원 입니다. '
speech.flush(); // Emit the remaining text at the end of the turn.
speech.reset(); // Discard pending text when the user interrupts.

Send only non-empty push()/flush() results to TTS; keep the original text for display. Stop accepting chunks from an interrupted turn before reset(). Cancel queued TTS/audio separately: reset() only clears text that has not been emitted. The session API is JavaScript/browser only; native callers can buffer text before calling the existing conversion API.

  • push() buffers until sentence punctuation (Western punctuation followed by whitespace, or CJK punctuation/newline). It retains decimals, common English abbreviations, parenthesized/manual tags, URLs/code, and split pronunciation terms. Call flush() only at turn completion. This conservative buffering trades some latency for intact numbers; it is not a general sentence parser.
  • normalize() and each pending buffer plus incoming chunk are limited to 10,000 UTF-16 code units. Oversized calls throw RangeError; a failed push() retains the previous buffer. Empty flush() returns ''.
  • Slash dates/fractions such as 3/4 stay unchanged by default. Clarify the date with the caller, use an ISO date/manual tag, or set dateOrder: 'mdy' | 'dmy' when the application knows the order. Yearless slash-date conversion is supported in Korean/English. Use fraction(1/2) for an explicit fraction.
  • Korean/English labels such as 인증번호, 예약번호, 계좌번호, verification code, and account number read identifiers digit by digit (or as serials), preserving leading zeroes. Use digits(...)/serial(...) when no label is present.
  • Pronunciation keys are literal and case-sensitive, with ASCII word boundaries. Manual tags and protected URLs/code take precedence; replacements are not parsed again. enabledTags filters automatic tags, while date preservation, labelled identifiers and pronunciation overrides remain active.

All automatic APIs now preserve HTTP(S)/www. URLs and backtick code. Korean/English automatic conversion also supports shared-unit decimal ranges (1.5~2.0kg, 1.5–2.0L) and international phone numbers/extensions. URL/code protection and these number improvements also apply to the native builds. Verify pronunciation with your chosen TTS voice before deploying.

API Reference

Auto-tagging Functions

autoTag(text, options?) - Convert text with auto-detected patterns
// English
autoTag('Call 555-123-4567 tomorrow.', { language: 'en' });
// → 'Call five five five, one two three, four five six seven tomorrow.'

// Enable specific tags only
autoTag('$500, 555-1234', { language: 'en', enabledTags: ['phone'] });
// → '$500, five five five, one two three four'
Option Type Default Description
language SupportedLanguage 'ko' Official ISO 639-3 code or a supported alias
enabledTags string[] all Tag types to enable

An explicit enabledTags list also disables unrelated abbreviation/unit post-processing. An empty list leaves the input unchanged.

extractAutoTags(text, options?) - Extract patterns without converting
extractAutoTags('Phone is 555-123-4567, total is $500.', { language: 'en' });
// [
//   { original: '555-123-4567', tagType: 'phone', start: 9, end: 21 },
//   { original: '$500', tagType: 'money', start: 33, end: 37 }
// ]

Manual-tagging Functions

manualTag(text, options?) - Parse and convert manual tags
manualTag('Hello, name(John).', { language: 'en' });
// → 'Hello, J O H N.'

manualTag('Amount is money(10000).', { language: 'en' });
// → 'Amount is ten thousand dollars.'
manualTagSelective(text, options) - Convert only specific tags
manualTagSelective('name(John) month(12)', { language: 'en', allowedTags: ['name'] });
// → 'J O H N month(12)'
extractTags(text, options?) - Extract manual tags without converting
extractTags('Hello, name(John).');
// [{ tag: 'name', value: 'John', start: 7, end: 17 }]

Combined Function

autoTagWithManual(text, options?) - Apply both auto and manual tags
autoTagWithManual('name(John), call 555-123-4567.', { language: 'en' });
// → 'J O H N, call five five five, one two three, four five six seven.'

Note: Manual tag results are preserved; auto-tagging applies only to the surrounding text. The 10,000-character input limit (MAX_INPUT_LENGTH, JavaScript string length) applies to the original input, not expanded output.

Numeric and money tags in Korean and English preserve values outside JavaScript’s safe integer range. Generic-language currency conversion preserves unsupported amounts (including more than 20 fractional digits). English and generic-language manual tags support one level of parentheses, such as phone(+1 (202) 555-0175).

Utility Functions

import {
  getSupportedLanguages,
  getSupportedAutoTags,
  getSupportedManualTags,
  setDefaultLanguage,
  getDefaultLanguage,
} from '@neosapience/typecast-autotag';

getSupportedLanguages(); // 5 short codes, 33 other official codes, then kor/eng/jpn/zho
getSupportedAutoTags(); // ['phone', 'datetime', 'time', 'date', ...]
getSupportedManualTags(); // ['name', 'month', 'day', 'date', ...]

Supported Tags

English Auto-tags (Automatically Detected)

Tag Description Input Output
phone Phone numbers 555-123-4567 five five five, one two three, four five six seven
datetime Date and time 2024-01-15T14:30 January fifteenth, twenty twenty-four, two thirty PM
time Time 2:30 PM two thirty PM
date Date January 15, 2024 January fifteenth, twenty twenty-four
money Currency amounts $1,500 one thousand five hundred dollars
year Year year 2024 year twenty twenty-four
month Month January January
day Day the 15th the fifteenth
order Ordinal numbers 1st place first place
point Points/scores 95 points ninety-five points
piece Counting 5 items five items
minsec Duration (m/s) 5m30s, 100ms five minutes thirty seconds, one hundred milliseconds
ratio Ratio/percent 50%, 1:2 fifty percent, one to two
duration Period 3 months three months
floor Floor numbers 5th floor, B1 fifth floor, basement one
weight Weight 5kg, 100lb five kilograms, one hundred pounds
distance Distance 5km, 100m five kilometers, one hundred meters
temperature Temperature 25°C, -5°F twenty-five degrees Celsius, minus five degrees Fahrenheit
volume Volume/capacity 500ml, 2L five hundred milliliters, two liters
dataCapacity Data capacity 100GB, 50Mbps one hundred gigabytes, fifty megabits per second
inch Inch 55 inches fifty-five inches

Korean Auto-tags (Automatically Detected)

Tag Description Input Output
phone Phone numbers 010-1234-5678 공 . 일 . 공 . 일 . 이 . 삼 . 사 . 오 . 육 . 칠 . 팔
datetime Date and time 2024-01-15T14:30 이천이십사년 일월 십오일 오후 두 시 삼십 분
time Time 14:30 오후 두 시 삼십 분
date Date 2024-01-15 이천이십사년 일월 십오일
money Currency amounts 50000원 오만 원
year Year 2024년 이천이십사년
month Month 12월 십이월
day Day 25일 이십오일
order Ordinal numbers 3번째, 2등 세 번째, 이 등
point Points/scores 95점 구십오 점
piece Counting 5개 다섯 개
minsec Duration (m/s) 5분30초, 100ms 오 분 삼십 초, 백 밀리초
ratio Ratio/percent 50%, 1:2 오십 퍼센트, 일 대 이
duration Period 3개월 삼 개월
floor Floor numbers 5층, B1층 오 층, 지하 일 층
weight Weight 5kg, 100g 오 킬로그램, 백 그램
distance Distance 5km 오 킬로미터
temperature Temperature 25℃, -5°C 이십오 도, 영하 오 도
volume Volume/capacity 500ml, 2L 오백 밀리리터, 이 리터
dataCapacity Data capacity 100GB, 50Mbps 백 기가바이트, 오십 메가비피에스
inch Inch 55인치 오십오 인치

Japanese Auto-tags (Automatically Detected)

Tag Description Input Output
phone Phone number 090-1234-5678 ゼロ・きゅう・ゼロ、いち・に・さん・よん、ご・ろく・なな・はち
postalCode Postal code 〒100-0001 郵便番号いち・ゼロ・ゼロ、ゼロ・ゼロ・ゼロ・いち
date / datetime Date and time 2026年7月14日 にせんにじゅうろくねんしちがつじゅうよっか
time Time 14:30 じゅうよじさんじゅっぷん
range Time, price, or page range 6–9時 ろくじからくじ
money Currency ¥12,800 いちまんにせんはっぴゃくえん
score / ratio Score or ratio スコアは3-2 スコアはさんたいに
percentage / fraction Percentage or fraction 72.5%, 1/2 ななじゅうにてんごパーセント, にぶんのいち
order Chapter, rank, or number 第7章, No. 5 だいななしょう, ナンバーご
unit Measurements and counters 25kg, 2人, 3本 にじゅうごキログラム, ふたり, さんぼん
email Email symbols help@example.jp help アットマーク example ドット jp
direction Direction arrow 東京→大阪 東京から大阪
serial / account Contextual identifiers 注文番号はAB-2048 注文番号はA・B、に・ゼロ・よん・はち
flight Flight number 便名はNH2048 便名はN・H・に・ゼロ・よん・はち
scripture Scripture reference ヨハネ3:16 ヨハネさんしょうじゅうろくせつ

Simplified Chinese Auto-tags (Automatically Detected)

Tag Description Input Output
phone Phone number 138-0013-8000 一·三·八、零·零·一·三、八·零·零·零
postalCode Postal code 邮编是100000 邮编是一·零·零·零·零·零
date / datetime Date and time 2026年7月14日 二零二六年七月十四日
time Time 14:30 十四点三十分
range Time, price, or page range 6–9点 六点到九点
money Currency ¥12,800 一万二千八百元
score / ratio Score or ratio 最终比分是3-2 最终比分是三比二
percentage / fraction Percentage or fraction 72.5%, 1/2 百分之七十二点五, 二分之一
order Chapter, rank, or number 第7章, No. 5 第七章, 编号五
unit Measurements and counters 25kg, 2人, 3本书 二十五千克, 两人, 三本书
email Email symbols help@example.cn help 艾特 example 点 cn
direction Direction arrow 北京→上海 北京到上海
serial / account Contextual identifiers 订单编号是AB-2048 订单编号是A·B、二·零·四·八
flight Flight number 航班号是MU512 航班号是M·U·五·一·二
scripture Scripture reference 约翰福音3:16 约翰福音三章十六节

Taiwan Mandarin Auto-tags (Automatically Detected)

Tag Description Input Output
phone Taiwan phone number 0912-345-678 零·九·一·二、三·四·五、六·七·八
postalCode Taiwan postal code 郵遞區號是10617 郵遞區號是一·零·六·一·七
date / datetime Date and time 2026年7月14日 二零二六年七月十四日
time / range Time and range 6–9點 六點到九點
money Taiwan currency NT$12,800 一萬二千八百新臺幣
score / ratio Score or ratio 最終比數是3-2 最終比數是三比二
unit Taiwan measurements 25kg, 30cm, 2TB 二十五公斤, 三十公分, 二太位元組
serial / account Contextual identifiers 訂單編號是AB-2048 訂單編號是A·B、二·零·四·八
flight Flight number 航班號是BR108 航班號是B·R·一·零·八
scripture Scripture reference 約翰福音3:16 約翰福音三章十六節
email Email symbols help@example.tw help 小老鼠 example 點 tw

Manual-only Tags

Tag Description English Syntax Korean Syntax
name Name (char-by-char) name(John) → J O H N name(김철수) → 김 . 철 . 수
digits Digit-by-digit digits(1234) → one two three four digits(1234) → 일 . 이 . 삼 . 사
address Address (Korean only) - address(102동 1101호 (엘지동, 아파트)) → 백이동 천백일호

Tip: All auto-tags can also be used as manual tags with explicit syntax.


Examples

Phone Numbers
// English
autoTag('555-123-4567', { language: 'en' }); // → 'five five five, one two three, four five six seven'
autoTag('(212) 555-1234', { language: 'en' }); // → 'two one two, five five five, one two three four'
autoTag('1-800-555-1234', { language: 'en' }); // → 'one, eight zero zero, five five five, one two three four'
autoTag('911', { language: 'en' }); // → 'nine one one'

// Korean
autoTag('010-1234-5678', { language: 'ko' }); // → '공 . 일 . 공 . 일 . 이 . 삼 . 사 . 오 . 육 . 칠 . 팔'
autoTag('02-123-4567', { language: 'ko' }); // → '공 . 이 . 일 . 이 . 삼 . 사 . 오 . 육 . 칠'
Dates and Times
// English
autoTag('January 15, 2024', { language: 'en' }); // → 'January fifteenth, twenty twenty-four'
autoTag('2:30 PM', { language: 'en' }); // → 'two thirty PM'
autoTag('10:00 AM', { language: 'en' }); // → 'ten AM'

// Korean
autoTag('2024-01-15', { language: 'ko' }); // → '이천이십사년 일월 십오일'
autoTag('14:30', { language: 'ko' }); // → '오후 두 시 삼십 분'
Money and Amounts
// English
autoTag('$50', { language: 'en' }); // → 'fifty dollars'
autoTag('$1,234.56', { language: 'en' }); // → 'one thousand two hundred thirty-four dollars and fifty-six cents'
autoTag('€100', { language: 'en' }); // → 'one hundred euros'

// Korean
autoTag('50000원', { language: 'ko' }); // → '오만 원'
autoTag('1,234,567원', { language: 'ko' }); // → '백이십삼만사천오백육십칠 원'
Names
// English
manualTag('name(John)', { language: 'en' }); // → 'J O H N'
manualTag('name(John Smith)', { language: 'en' }); // → 'J O H N S M I T H'

// Korean
manualTag('name(김철수)', { language: 'ko' }); // → '김 . 철 . 수'
manualTag('name(홍길동)', { language: 'ko' }); // → '홍 . 길 . 동'

Use Cases

AICC (AI Contact Center)

Perfect for converting structured data to natural speech in automated phone systems:

// English
const script = autoTagWithManual(
  `
  Hello, name(${customerName}).
  Your order will be delivered on ${deliveryDate}.
  For questions, call ${supportPhone}.
`,
  { language: 'en' }
);

// Korean
const script = autoTagWithManual(
  `
  안녕하세요, name(${customerName})님.
  주문하신 상품이 ${deliveryDate}에 배송될 예정입니다.
  문의사항은 ${supportPhone}으로 연락주세요.
`,
  { language: 'ko' }
);

IVR Systems

Generate natural-sounding automated responses:

// English
autoTag('Your balance is $1,234.56.', { language: 'en' });
// → 'Your balance is one thousand two hundred thirty-four dollars and fifty-six cents.'

// Korean
autoTag('고객님의 잔액은 1,234,567원입니다.', { language: 'ko' });
// → '고객님의 잔액은 백이십삼만사천오백육십칠 원 입니다.'

Advanced Usage

Direct Language Module Access

import { korean, english } from '@neosapience/typecast-autotag';

// Use language-specific functions
korean.autoTag('010-1234-5678');
english.autoTag('555-123-4567');

// Access individual tag converters through the language modules
korean.name('김철수');
english.phone('555-123-4567');

Development

Prerequisites

  • Node.js >= 18
  • pnpm 9.x

Quick Setup

# Clone and setup everything (including C binding)
git clone <repository-url>
cd typecast-autotag
pnpm setup

Commands

Command Description
pnpm install Install dependencies
pnpm setup Full setup (install + build + c-binding)
pnpm dev Watch mode
pnpm build Build for production
pnpm test Run all tests (jest + e2e)
pnpm test:jest Run jest tests only
pnpm test:e2e Run e2e tests only
pnpm test:coverage Run tests with coverage
pnpm typecheck Type check
pnpm lint Lint code
pnpm format Format code

Other Bindings

Language Documentation
C/C++ c-binding/README.md
Python python-binding/README.md
Java java-binding/README.md

Project Structure

src/
├── index.ts                    # Main entry point
├── korean/                     # Korean language module
│   ├── index.ts                # Korean module exports
│   ├── auto-tag.ts             # Auto-tagging logic
│   ├── manual-tag.ts           # Manual-tagging logic
│   ├── tags/                   # Individual tag converters
│   └── utils/
│       └── number-to-korean.ts # Number conversion utilities
├── english/                    # English language module
    ├── index.ts                # English module exports
    ├── auto-tag.ts             # Auto-tagging logic
    ├── manual-tag.ts           # Manual-tagging logic
    ├── tags/                   # Individual tag converters
    └── utils/
│       └── number-to-english.ts # Number conversion utilities
├── japanese/                   # Japanese language module
│   └── index.ts                # Japanese rules and number readings
├── chinese/                    # Simplified Chinese language module
│   └── index.ts                # Chinese rules and number readings
└── taiwanese-mandarin/         # Taiwan Mandarin adapter
    └── index.ts                # Taiwan readings over shared Chinese rules

Releasing

npm, Python, Java, and native libraries use independent versions. Follow PUBLISHING.md to validate and publish the affected package. npm publishing also records the matching GitHub Release; npm releases do not include native binaries.

License

This project is licensed under the MIT License — Copyright (c) 2026 Neosapience, Inc.



About

Text preprocessing SDK for TTS - convert text to speech-friendly format

Topics

Resources

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages