urdu-text-utils 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/chars.ts","../src/normalize.ts","../src/numbers.ts","../src/detect.ts","../src/stats.ts","../src/collate.ts","../src/search.ts","../src/transliterate.ts"],"names":[],"mappings":";;;AAoBO,IAAM,gBAAA,GAAmB,sDAAA;AAEzB,IAAM,gBAAgB,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,gBAAgB,KAAK,IAAI,CAAA;AAG9D,IAAM,UAAA,GAAa,KAAA;AAGnB,IAAM,YAAA,GAAe,oBAAA;AAGrB,IAAM,OAAA,GAAU,KAAA;AAOvB,IAAM,oBAAA,GACJ,6JAAA;AAIK,IAAM,mBAAmB,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,oBAAoB,KAAK,GAAG,CAAA;AAKpE,IAAM,eAAA,GAAkB,SAAA;AAGxB,IAAM,WAAA,GAAc,8DAAA;AACpB,IAAM,mBAAA,GAAsB,8DAAA;AAC5B,IAAM,YAAA,GAAe,YAAA;AAErB,IAAM,cAAA,GAAiB,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,YAAY,GAAG,WAAW,CAAA,EAAG,mBAAmB,CAAA,CAAA,CAAA,EAAK,IAAI,CAAA;AAG/F,IAAM,iBAAA,GAAoB,YAAA;AAG1B,IAAM,aAAA,GACX,sCAAA;;;AC1CF,IAAM,QAAA,GAAW,QAAA;AACjB,IAAM,UAAA,GAAa,QAAA;AACnB,IAAM,aAAA,GAAgB,QAAA;AACtB,IAAM,IAAA,GAAO,QAAA;AACb,IAAM,GAAA,GAAM,QAAA;AAEZ,IAAM,UAAA,GAAqC;AAAA;AAAA,EAEzC,QAAA,EAAK,QAAA;AAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA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AAA;AACT","file":"index.cjs","sourcesContent":["/**\n * Shared Unicode building blocks for the Arabic script as used by Urdu.\n *\n * Blocks worth remembering:\n * U+0600-U+06FF Arabic (Urdu letters live here, plus the U+06Ax-U+06Dx extras)\n * U+0750-U+077F Arabic Supplement\n * U+08A0-U+08FF Arabic Extended-A\n * U+FB50-U+FDFF Arabic Presentation Forms-A\n * U+FE70-U+FEFC Arabic Presentation Forms-B\n *\n * Every class below is written with \\u escapes on purpose: these characters are\n * invisible or shape-shifting in an editor, and a silently wrong literal is the\n * single easiest way to break an Urdu pipeline.\n */\n\n/**\n * Combining marks: harakat (ً-ٟ), quranic annotation (ۖ-ۭ),\n * superscript alef (ٰ) and the ؐ-ؚ honorific marks.\n * Deliberately excludes U+06D4 (Urdu full stop ۔), U+06D2 (ے) and U+06D3 (ۓ).\n */\nexport const DIACRITIC_RANGES = \"\\\\u0610-\\\\u061A\\\\u064B-\\\\u065F\\\\u0670\\\\u06D6-\\\\u06ED\";\n\nexport const DIACRITICS_RE = new RegExp(`[${DIACRITIC_RANGES}]`, \"gu\");\n\n/** Tatweel / kashida U+0640 — display padding, never meaning. */\nexport const TATWEEL_RE = /ـ/gu;\n\n/** Bidi controls, joiners and BOM that leak in from copy-paste. ZWNJ is handled separately. */\nexport const INVISIBLE_RE = /[​‍-‏‪-‮⁠-⁤⁦-⁩]/gu;\n\n/** Zero-width non-joiner U+200C: occasionally meaningful, so stripped only on request. */\nexport const ZWNJ_RE = /‌/gu;\n\nconst ARABIC_SCRIPT_RANGES = \"\\\\u0600-\\\\u06FF\\\\u0750-\\\\u077F\\\\u08A0-\\\\u08FF\\\\uFB50-\\\\uFDFF\\\\uFE70-\\\\uFEFC\";\n\n/** Any Arabic-script character: letters, marks, punctuation, digits, presentation forms. */\nexport const ARABIC_SCRIPT_RE = new RegExp(`[${ARABIC_SCRIPT_RANGES}]`, \"u\");\n\nconst ARABIC_LETTER_RANGES =\n \"\\\\u0620-\\\\u063F\\\\u0641-\\\\u064A\\\\u066E\\\\u066F\\\\u0671-\\\\u06D3\\\\u06D5\\\\u06EE\\\\u06EF\\\\u06FA-\\\\u06FF\" +\n \"\\\\u0750-\\\\u077F\\\\u08A0-\\\\u08FF\\\\uFB50-\\\\uFDFF\\\\uFE70-\\\\uFEFC\";\n\n/** Arabic-script letters only — no marks, no digits, no punctuation, no tatweel. */\nexport const ARABIC_LETTER_RE = new RegExp(`[${ARABIC_LETTER_RANGES}]`, \"u\");\nexport const ARABIC_LETTER_RE_G = new RegExp(`[${ARABIC_LETTER_RANGES}]`, \"gu\");\n\n/** Letters of any script — the denominator when measuring \"how Urdu is this text\". */\nexport const ANY_LETTER_RE = /\\p{L}/u;\nexport const ANY_LETTER_RE_G = /\\p{L}/gu;\n\n/** Urdu digits ۰-۹ (U+06F0) and Arabic-Indic digits ٠-٩ (U+0660) are two distinct blocks. */\nexport const URDU_DIGITS = \"۰۱۲۳۴۵۶۷۸۹\";\nexport const ARABIC_INDIC_DIGITS = \"٠١٢٣٤٥٦٧٨٩\";\nexport const ASCII_DIGITS = \"0123456789\";\n\nexport const ANY_DIGIT_RE_G = new RegExp(`[${ASCII_DIGITS}${URDU_DIGITS}${ARABIC_INDIC_DIGITS}]`, \"gu\");\n\n/** Sentence terminators: Urdu full stop ۔, Arabic question mark ؟, ASCII . ! ? and ellipsis. */\nexport const SENTENCE_SPLIT_RE = /[۔؟?!.…]+/u;\n\n/** Word separators: whitespace plus punctuation that cannot occur inside an Urdu word. */\nexport const WORD_SPLIT_RE =\n /[\\s،؛؟۔٫٬…!-\\/:-@\\[-`{-~‐-‧«»‘’“”]+/u;\n","import {\n ARABIC_INDIC_DIGITS,\n ASCII_DIGITS,\n DIACRITICS_RE,\n INVISIBLE_RE,\n TATWEEL_RE,\n URDU_DIGITS,\n ZWNJ_RE,\n} from \"./chars.js\";\nimport type { DigitStyle } from \"./numbers.js\";\n\n/**\n * Arabic-script characters that Urdu writes with a different codepoint.\n *\n * The direction matters and is a common source of bugs: Urdu uses\n * ہ (U+06C1 heh goal) and ی (U+06CC farsi yeh), NOT the Arabic\n * ه (U+0647) and ي (U+064A). Text pasted from Arabic keyboards,\n * Windows-1256 conversions or older CMSes carries the Arabic forms,\n * which then fail every naive `===` comparison.\n */\nconst URDU_YEH = \"ی\"; // ی farsi yeh\nconst URDU_KEHEH = \"ک\"; // ک keheh\nconst URDU_HEH_GOAL = \"ہ\"; // ہ heh goal\nconst ALEF = \"ا\"; // ا\nconst WAW = \"و\"; // و\n\nconst LETTER_MAP: Record<string, string> = {\n // yeh family -> ی. Note ے (U+06D2 bari ye) is a distinct letter and is preserved.\n \"ي\": URDU_YEH, // ي arabic yeh\n \"ى\": URDU_YEH, // ى alef maksura\n \"ۍ\": URDU_YEH, // ۍ yeh with tail\n \"ې\": URDU_YEH, // ې pashto e\n \"ؠ\": URDU_YEH, // ؠ kashmiri yeh\n // kaf family -> ک\n \"ك\": URDU_KEHEH, // ك arabic kaf\n \"ڪ\": URDU_KEHEH, // ڪ swash kaf\n // heh family -> ہ. ھ (U+06BE do-chashmi heh) is a distinct letter and is preserved.\n \"ه\": URDU_HEH_GOAL, // ه arabic heh\n \"ۀ\": URDU_HEH_GOAL, // ۀ heh with yeh above\n \"ة\": URDU_HEH_GOAL, // ة teh marbuta\n \"ۃ\": URDU_HEH_GOAL, // ۃ teh marbuta goal\n \"ە\": URDU_HEH_GOAL, // ە ae\n // alef family -> ا. آ (U+0622 alef madda) is a real Urdu letter and is preserved.\n \"أ\": ALEF, // أ alef with hamza above\n \"إ\": ALEF, // إ alef with hamza below\n \"ٱ\": ALEF, // ٱ alef wasla\n \"ٲ\": ALEF, // ٲ alef with wavy hamza above\n \"ٳ\": ALEF, // ٳ alef with wavy hamza below\n // waw family -> و. ؤ (U+0624) is preserved: it carries hamza meaningfully in Urdu.\n \"ۋ\": WAW, // ۋ ve\n \"ۆ\": WAW, // ۆ oe\n \"ۇ\": WAW, // ۇ u\n};\n\nconst digitTargets: Record<DigitStyle, string> = {\n urdu: URDU_DIGITS,\n english: ASCII_DIGITS,\n arabic: ARABIC_INDIC_DIGITS,\n};\n\nexport interface NormalizeOptions {\n /** Apply Unicode NFKC first, folding presentation forms (ﻻ, ﮐ) back to real letters. Default `true`. */\n compatibility?: boolean;\n /** Strip harakat and quranic marks. Default `false` — see {@link removeDiacritics}. */\n stripDiacritics?: boolean;\n /** Remove tatweel/kashida padding. Default `true`. */\n stripTatweel?: boolean;\n /** Remove zero-width non-joiner. Default `false`, since ZWNJ can be meaningful. */\n stripZwnj?: boolean;\n /** Collapse whitespace runs to a single space and trim. Default `true`. */\n collapseWhitespace?: boolean;\n /** Rewrite every digit to one style. Default `\"preserve\"`. */\n digits?: DigitStyle | \"preserve\";\n /** Map ASCII `,` `;` `?` to Urdu `،` `؛` `؟`. Default `false`. */\n urduPunctuation?: boolean;\n}\n\nconst PUNCTUATION_MAP: Record<string, string> = {\n \",\": \"،\", // ،\n \";\": \"؛\", // ؛\n \"?\": \"؟\", // ؟\n};\n\nconst DIGIT_LOOKUP = new Map<string, number>();\nfor (const set of [ASCII_DIGITS, URDU_DIGITS, ARABIC_INDIC_DIGITS]) {\n for (let i = 0; i < 10; i++) DIGIT_LOOKUP.set(set[i]!, i);\n}\n\n/**\n * Fold an Urdu string to a single canonical Unicode form.\n *\n * @example\n * normalizeUrdu(\"كيا حال ہے\") // \"کیا حال ہے\"\n */\nexport function normalizeUrdu(input: string, options: NormalizeOptions = {}): string {\n if (!input) return \"\";\n\n const {\n compatibility = true,\n stripDiacritics = false,\n stripTatweel = true,\n stripZwnj = false,\n collapseWhitespace = true,\n digits = \"preserve\",\n urduPunctuation = false,\n } = options;\n\n let text = compatibility ? input.normalize(\"NFKC\") : input.normalize(\"NFC\");\n\n text = text.replace(INVISIBLE_RE, \"\");\n if (stripZwnj) text = text.replace(ZWNJ_RE, \"\");\n if (stripTatweel) text = text.replace(TATWEEL_RE, \"\");\n if (stripDiacritics) text = text.replace(DIACRITICS_RE, \"\");\n\n const digitTarget = digits === \"preserve\" ? null : digitTargets[digits];\n\n let out = \"\";\n for (const ch of text) {\n const mapped = LETTER_MAP[ch];\n if (mapped !== undefined) {\n out += mapped;\n continue;\n }\n if (digitTarget) {\n const value = DIGIT_LOOKUP.get(ch);\n if (value !== undefined) {\n out += digitTarget[value];\n continue;\n }\n }\n if (urduPunctuation) {\n const punct = PUNCTUATION_MAP[ch];\n if (punct !== undefined) {\n out += punct;\n continue;\n }\n }\n out += ch;\n }\n\n if (collapseWhitespace) out = out.replace(/\\s+/gu, \" \").trim();\n\n return out;\n}\n\n/**\n * Strip harakat, quranic annotation marks and superscript alef.\n * Keeps ۔ ے ۓ, which are letters/punctuation rather than marks.\n *\n * @example\n * removeDiacritics(\"مُحَمَّد\") // \"محمد\"\n */\nexport function removeDiacritics(input: string): string {\n if (!input) return \"\";\n return input.normalize(\"NFC\").replace(DIACRITICS_RE, \"\");\n}\n\n/**\n * The comparison key used by {@link searchUrdu} and {@link sortUrdu}:\n * normalized, diacritic-free, lowercased, whitespace-collapsed.\n * Two strings that a reader would call \"the same word\" should fold to the same key.\n */\nexport function foldUrdu(input: string): string {\n return normalizeUrdu(input, {\n stripDiacritics: true,\n stripZwnj: true,\n collapseWhitespace: true,\n }).toLowerCase();\n}\n","import { ARABIC_INDIC_DIGITS, ASCII_DIGITS, URDU_DIGITS } from \"./chars.js\";\n\nconst SETS = {\n urdu: URDU_DIGITS,\n english: ASCII_DIGITS,\n arabic: ARABIC_INDIC_DIGITS,\n} as const;\n\nexport type DigitStyle = keyof typeof SETS;\n\nconst VALUE_OF = new Map<string, number>();\nfor (const set of Object.values(SETS)) {\n for (let i = 0; i < 10; i++) VALUE_OF.set(set[i]!, i);\n}\n\nfunction convert(input: string, target: DigitStyle): string {\n if (!input) return \"\";\n const digits = SETS[target];\n let out = \"\";\n for (const ch of input) {\n const value = VALUE_OF.get(ch);\n out += value === undefined ? ch : digits[value];\n }\n return out;\n}\n\n/** `12345` -> `۱۲۳۴۵`. Accepts Arabic-Indic digits as input too. */\nexport function toUrduDigits(input: string): string {\n return convert(input, \"urdu\");\n}\n\n/** `۱۲۳۴۵` -> `12345`. Safe to feed into `Number()` afterwards. */\nexport function toEnglishDigits(input: string): string {\n return convert(input, \"english\");\n}\n\n/** `۱۲۳۴۵` -> `١٢٣٤٥` (Arabic-Indic, U+0660 block — a different block from Urdu's). */\nexport function toArabicIndicDigits(input: string): string {\n return convert(input, \"arabic\");\n}\n\n/**\n * Rewrite every digit in `input` to one style.\n *\n * @example\n * convertNumbers(\"12345\") // \"۱۲۳۴۵\"\n * convertNumbers(\"۱۲۳۴۵\", \"english\") // \"12345\"\n */\nexport function convertNumbers(input: string, to: DigitStyle = \"urdu\"): string {\n return convert(input, to);\n}\n\n/**\n * Parse a number written with Urdu or Arabic-Indic digits.\n * Handles the Urdu decimal separator ٫ and thousands separator ٬.\n * Returns `NaN` when the string is not a number.\n */\nexport function parseUrduNumber(input: string): number {\n if (!input) return NaN;\n const ascii = toEnglishDigits(input)\n .replace(/[٬,\\s]/gu, \"\")\n .replace(/٫/gu, \".\");\n if (!/^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)$/u.test(ascii)) return NaN;\n return Number(ascii);\n}\n\nconst ONES = [\"\", \"ایک\", \"دو\", \"تین\", \"چار\", \"پانچ\", \"چھ\", \"سات\", \"آٹھ\", \"نو\"];\nconst TEENS_AND_TENS: Record<number, string> = {\n 10: \"دس\",\n 11: \"گیارہ\",\n 12: \"بارہ\",\n 13: \"تیرہ\",\n 14: \"چودہ\",\n 15: \"پندرہ\",\n 16: \"سولہ\",\n 17: \"سترہ\",\n 18: \"اٹھارہ\",\n 19: \"انیس\",\n 20: \"بیس\",\n 30: \"تیس\",\n 40: \"چالیس\",\n 50: \"پچاس\",\n 60: \"ساٹھ\",\n 70: \"ستر\",\n 80: \"اسی\",\n 90: \"نوے\",\n 100: \"سو\",\n};\n\n/**\n * Spell a whole number in Urdu words, using the South Asian scale\n * (ہزار, لاکھ, کروڑ, ارب) rather than the western million/billion scale.\n *\n * Coverage note: 21-99 that are not multiples of ten are written compositionally\n * (`اکیس` etc. are irregular in real Urdu, so this returns `بیس ایک`-style forms\n * only as a fallback). Marked experimental for that reason.\n *\n * @experimental\n */\nexport function numberToUrduWords(value: number): string {\n if (!Number.isFinite(value)) return \"\";\n if (!Number.isInteger(value)) throw new TypeError(\"numberToUrduWords expects an integer\");\n if (value < 0) return `منفی ${numberToUrduWords(-value)}`;\n if (value === 0) return \"صفر\";\n\n const scales: Array<[number, string]> = [\n [10_000_000, \"کروڑ\"],\n [100_000, \"لاکھ\"],\n [1_000, \"ہزار\"],\n [100, \"سو\"],\n ];\n\n const parts: string[] = [];\n let rest = value;\n for (const [size, name] of scales) {\n if (rest >= size) {\n const count = Math.floor(rest / size);\n rest %= size;\n parts.push(`${numberToUrduWords(count)} ${name}`);\n }\n }\n if (rest > 0) {\n if (TEENS_AND_TENS[rest]) {\n parts.push(TEENS_AND_TENS[rest]!);\n } else if (rest < 10) {\n parts.push(ONES[rest]!);\n } else {\n const tens = Math.floor(rest / 10) * 10;\n parts.push(`${TEENS_AND_TENS[tens] ?? \"\"} ${ONES[rest % 10] ?? \"\"}`.trim());\n }\n }\n return parts.join(\" \").replace(/\\s+/gu, \" \").trim();\n}\n","import { ANY_LETTER_RE_G, ARABIC_LETTER_RE } from \"./chars.js\";\n\nexport interface IsUrduOptions {\n /**\n * Minimum share of Arabic-script letters among all letters, 0-1. Default `0.5`.\n * A ratio rather than \"contains any Urdu\" so that a mostly-English string with\n * one Urdu word does not count as Urdu.\n */\n threshold?: number;\n /** Require at least this many Arabic-script letters. Default `1`. */\n minLetters?: number;\n}\n\n/**\n * Ratio of Arabic-script letters to all letters, 0-1.\n * Returns 0 for text with no letters at all (digits, punctuation, emoji).\n */\nexport function urduRatio(input: string): number {\n if (!input) return 0;\n let letters = 0;\n let urdu = 0;\n for (const ch of input.match(ANY_LETTER_RE_G) ?? []) {\n letters++;\n if (ARABIC_LETTER_RE.test(ch)) urdu++;\n }\n return letters === 0 ? 0 : urdu / letters;\n}\n\n/**\n * Is this text Urdu (more precisely: predominantly Arabic-script)?\n *\n * The Arabic script is shared by Urdu, Arabic, Persian, Pashto and others, so\n * this cannot distinguish Urdu from Arabic on script alone. Use\n * {@link hasUrduSpecificLetters} when that distinction matters.\n *\n * @example\n * isUrdu(\"آپ کیسے ہیں؟\") // true\n */\nexport function isUrdu(input: string, options: IsUrduOptions = {}): boolean {\n const { threshold = 0.5, minLetters = 1 } = options;\n if (!input) return false;\n\n let letters = 0;\n let urdu = 0;\n for (const ch of input.match(ANY_LETTER_RE_G) ?? []) {\n letters++;\n if (ARABIC_LETTER_RE.test(ch)) urdu++;\n }\n if (urdu < minLetters) return false;\n return letters > 0 && urdu / letters >= threshold;\n}\n\n/** Letters that exist in Urdu but not in Arabic — the only reliable script-level signal. */\nconst URDU_ONLY = new Set([\n \"ٹ\", // ٹ tteh\n \"ڈ\", // ڈ ddal\n \"ڑ\", // ڑ rreh\n \"ں\", // ں noon ghunna\n \"ے\", // ے bari ye\n \"ۓ\", // ۓ bari ye with hamza\n \"ہ\", // ہ heh goal\n \"ھ\", // ھ do-chashmi heh\n \"ک\", // ک keheh\n \"گ\", // گ gaf\n \"چ\", // چ tcheh\n \"پ\", // پ peh\n \"ژ\", // ژ jeh\n \"ی\", // ی farsi yeh\n]);\n\n/**\n * True when the text contains at least one letter that Arabic does not use.\n * Cheap way to separate Urdu/Persian-family text from Arabic text.\n */\nexport function hasUrduSpecificLetters(input: string): boolean {\n for (const ch of input) if (URDU_ONLY.has(ch)) return true;\n return false;\n}\n","import {\n ANY_DIGIT_RE_G,\n DIACRITICS_RE,\n SENTENCE_SPLIT_RE,\n WORD_SPLIT_RE,\n} from \"./chars.js\";\nimport { urduRatio } from \"./detect.js\";\n\n/** Words in the text. Splits on whitespace and punctuation, so `ہے۔` counts once. */\nexport function countWords(input: string): number {\n return splitWords(input).length;\n}\n\n/** The word list behind {@link countWords}. Useful for tokenizing before search or indexing. */\nexport function splitWords(input: string): string[] {\n if (!input) return [];\n return input\n .split(WORD_SPLIT_RE)\n .map((w) => w.trim())\n .filter((w) => w.length > 0);\n}\n\n/** Sentences, split on ۔ ؟ ! . and ellipsis. */\nexport function countSentences(input: string): number {\n return splitSentences(input).length;\n}\n\nexport function splitSentences(input: string): string[] {\n if (!input) return [];\n return input\n .split(SENTENCE_SPLIT_RE)\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n}\n\nexport interface UrduStats {\n /** Every codepoint, including spaces and diacritics. */\n characters: number;\n charactersNoSpaces: number;\n words: number;\n sentences: number;\n /** Whitespace-delimited blocks separated by a blank line. */\n paragraphs: number;\n /** Share of Arabic-script letters among all letters, 0-100, rounded. */\n urduPercentage: number;\n diacritics: number;\n digits: number;\n averageWordsPerSentence: number;\n /** At 180 Urdu words per minute — slower than English because the script is denser. */\n readingTimeMinutes: number;\n}\n\n/**\n * Character, word, sentence and script statistics for a block of text.\n *\n * @example\n * analyzeUrdu(\"پاکستان ایک خوبصورت ملک ہے۔ اس کی آبادی زیادہ ہے۔\")\n */\nexport function analyzeUrdu(input: string): UrduStats {\n const text = input ?? \"\";\n const characters = [...text].length;\n const charactersNoSpaces = [...text.replace(/\\s/gu, \"\")].length;\n const words = countWords(text);\n const sentences = countSentences(text);\n const paragraphs = text\n .split(/\\n\\s*\\n/u)\n .map((p) => p.trim())\n .filter((p) => p.length > 0).length;\n\n return {\n characters,\n charactersNoSpaces,\n words,\n sentences,\n paragraphs,\n urduPercentage: Math.round(urduRatio(text) * 100),\n diacritics: (text.match(DIACRITICS_RE) ?? []).length,\n digits: (text.match(ANY_DIGIT_RE_G) ?? []).length,\n averageWordsPerSentence: sentences === 0 ? 0 : Math.round((words / sentences) * 10) / 10,\n readingTimeMinutes: Math.round((words / 180) * 10) / 10,\n };\n}\n","import { foldUrdu } from \"./normalize.js\";\n\n/**\n * Urdu alphabetical order (حروف تہجی).\n *\n * `Intl.Collator(\"ur\")` is not usable here: in most runtimes the `ur` locale\n * falls back to root Arabic collation, which orders ک/گ/ٹ/ڈ/ڑ/ں/ے by codepoint\n * instead of by their place in the Urdu alphabet. So the order is spelled out.\n *\n * Variant letters (ؤ, ئ, ۂ) are given the weight of their base letter plus a\n * tiebreaker, so `پاؤں` sorts next to `پاوں` rather than at the end of the list.\n */\nconst ALPHABET = [\n \"ا\",\n \"آ\",\n \"ب\",\n \"پ\",\n \"ت\",\n \"ٹ\",\n \"ث\",\n \"ج\",\n \"چ\",\n \"ح\",\n \"خ\",\n \"د\",\n \"ڈ\",\n \"ذ\",\n \"ر\",\n \"ڑ\",\n \"ز\",\n \"ژ\",\n \"س\",\n \"ش\",\n \"ص\",\n \"ض\",\n \"ط\",\n \"ظ\",\n \"ع\",\n \"غ\",\n \"ف\",\n \"ق\",\n \"ک\",\n \"گ\",\n \"ل\",\n \"م\",\n \"ن\",\n \"ں\",\n \"و\",\n \"ہ\",\n \"ھ\",\n \"ء\",\n \"ی\",\n \"ے\",\n];\n\n/** Letters that share a primary weight with a base letter, plus their secondary weight. */\nconst VARIANTS: Record<string, [base: string, secondary: number]> = {\n \"ؤ\": [\"و\", 1], // ؤ waw with hamza\n \"ئ\": [\"ی\", 1], // ئ yeh with hamza\n \"ۂ\": [\"ہ\", 1], // ۂ heh goal with hamza\n \"ۓ\": [\"ے\", 1], // ۓ bari ye with hamza\n};\n\nconst WEIGHTS = new Map<string, [number, number]>();\nALPHABET.forEach((ch, index) => WEIGHTS.set(ch, [(index + 1) * 10, 0]));\nfor (const [ch, [base, secondary]] of Object.entries(VARIANTS)) {\n const baseWeight = WEIGHTS.get(base);\n if (baseWeight) WEIGHTS.set(ch, [baseWeight[0], secondary]);\n}\n\n/** Non-alphabet characters sort after every Urdu letter, ordered by codepoint. */\nconst NON_LETTER_BASE = (ALPHABET.length + 1) * 10;\n\nfunction weightsOf(text: string): number[] {\n const out: number[] = [];\n for (const ch of text) {\n const weight = WEIGHTS.get(ch);\n if (weight) {\n out.push(weight[0], weight[1]);\n } else if (ch === \" \") {\n out.push(1, 0); // spaces sort before letters, so \"ابو بکر\" precedes \"ابوبکر\"\n } else {\n out.push(NON_LETTER_BASE + (ch.codePointAt(0) ?? 0), 0);\n }\n }\n return out;\n}\n\n/**\n * Comparator for Urdu strings, usable directly in `Array.prototype.sort`.\n * Diacritics and Unicode variants are folded first, so spelling noise does not\n * change the order.\n */\nexport function compareUrdu(a: string, b: string): number {\n const left = weightsOf(foldUrdu(a));\n const right = weightsOf(foldUrdu(b));\n const length = Math.min(left.length, right.length);\n for (let i = 0; i < length; i++) {\n const diff = left[i]! - right[i]!;\n if (diff !== 0) return diff;\n }\n return left.length - right.length;\n}\n\nexport interface SortOptions<T> {\n /** Sort descending. Default `false`. */\n descending?: boolean;\n /** Read the sort key out of each item, for sorting objects. */\n getText?: (item: T) => string;\n}\n\n/**\n * Sort strings in Urdu alphabetical order.\n *\n * @example\n * sortUrdu([\"گل\", \"آم\", \"بادام\"]) // [\"آم\", \"بادام\", \"گل\"]\n */\nexport function sortUrdu<T>(items: readonly T[], options: SortOptions<T> = {}): T[] {\n const { descending = false, getText } = options;\n const key = getText ?? ((item: T) => String(item));\n const sorted = [...items].sort((a, b) => compareUrdu(key(a), key(b)));\n return descending ? sorted.reverse() : sorted;\n}\n","import { foldUrdu, normalizeUrdu } from \"./normalize.js\";\nimport { splitWords } from \"./stats.js\";\n\nexport interface SearchOptions<T> {\n /** Read the searchable text out of each item, for searching objects. */\n getText?: (item: T) => string;\n /**\n * Allow small spelling differences via edit distance on individual words.\n * Costs O(query x item) per candidate word, so it runs only after the exact\n * substring pass fails. Default `false`.\n */\n fuzzy?: boolean;\n /** Maximum edit distance per word when `fuzzy` is on. Default `1`. */\n maxDistance?: number;\n /** Cap the number of results. */\n limit?: number;\n /** Return matches ordered by score (best first) instead of input order. Default `true`. */\n sortByScore?: boolean;\n}\n\nexport interface SearchResult<T> {\n item: T;\n /** 1 = exact fold match, 0.9 = prefix, 0.8 = substring, lower = fuzzy word match. */\n score: number;\n}\n\n/** Levenshtein distance with early exit once the limit is exceeded. */\nexport function editDistance(a: string, b: string, limit = Infinity): number {\n if (a === b) return 0;\n if (Math.abs(a.length - b.length) > limit) return limit + 1;\n\n let previous = Array.from({ length: b.length + 1 }, (_, i) => i);\n let current = new Array<number>(b.length + 1);\n\n for (let i = 1; i <= a.length; i++) {\n current[0] = i;\n let rowMin = current[0]!;\n for (let j = 1; j <= b.length; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n current[j] = Math.min(current[j - 1]! + 1, previous[j]! + 1, previous[j - 1]! + cost);\n rowMin = Math.min(rowMin, current[j]!);\n }\n if (rowMin > limit) return limit + 1;\n [previous, current] = [current, previous];\n }\n return previous[b.length]!;\n}\n\nfunction scoreOf(query: string, text: string, options: { fuzzy: boolean; maxDistance: number }): number {\n if (!query) return 0;\n if (text === query) return 1;\n if (text.startsWith(query)) return 0.9;\n if (text.includes(query)) return 0.8;\n\n if (!options.fuzzy) return 0;\n\n // Compare word by word: a one-letter typo inside a long sentence should still hit.\n const queryWords = splitWords(query);\n const textWords = splitWords(text);\n if (queryWords.length === 0 || textWords.length === 0) return 0;\n\n let matched = 0;\n for (const qw of queryWords) {\n const limit = Math.min(options.maxDistance, Math.max(1, Math.floor(qw.length / 3)));\n const hit = textWords.some(\n (tw) => tw.includes(qw) || editDistance(qw, tw, limit) <= limit,\n );\n if (hit) matched++;\n }\n if (matched === 0) return 0;\n return (matched / queryWords.length) * 0.7;\n}\n\n/**\n * Search a list of Urdu strings, ignoring diacritics and Unicode variant spellings.\n *\n * Both sides are folded with {@link foldUrdu} first, so `محمد` matches `مُحَمَّد`\n * and Arabic-keyboard `محمد` (with ه/ي) matches Urdu-keyboard `محمد`.\n *\n * @example\n * searchUrdu(\"محمد\", [\"مُحَمَّد علی\", \"احمد\", \"محمد خان\"])\n * // [\"مُحَمَّد علی\", \"محمد خان\"]\n */\nexport function searchUrdu<T = string>(\n query: string,\n items: readonly T[],\n options: SearchOptions<T> = {},\n): T[] {\n return searchUrduRanked(query, items, options).map((r) => r.item);\n}\n\n/** Same as {@link searchUrdu} but keeps the match scores. */\nexport function searchUrduRanked<T = string>(\n query: string,\n items: readonly T[],\n options: SearchOptions<T> = {},\n): Array<SearchResult<T>> {\n const { getText, fuzzy = false, maxDistance = 1, limit, sortByScore = true } = options;\n const read = getText ?? ((item: T) => String(item));\n\n const folded = foldUrdu(query);\n if (!folded) return [];\n\n const results: Array<SearchResult<T>> = [];\n for (const item of items) {\n const score = scoreOf(folded, foldUrdu(read(item)), { fuzzy, maxDistance });\n if (score > 0) results.push({ item, score });\n }\n\n if (sortByScore) results.sort((a, b) => b.score - a.score);\n return limit === undefined ? results : results.slice(0, limit);\n}\n\n/**\n * Highlight every occurrence of `query` in `text` by wrapping it.\n * Matching is diacritic-insensitive, but the returned string keeps the original\n * spelling and diacritics intact — offsets are mapped back to the source.\n */\nexport function highlightUrdu(\n text: string,\n query: string,\n wrap: (match: string) => string = (m) => `<mark>${m}</mark>`,\n): string {\n const foldedQuery = foldUrdu(query);\n if (!foldedQuery || !text) return text;\n\n // Fold character by character so folded offsets map back to source offsets.\n const sourceChars = [...text];\n const foldedChars: string[] = [];\n const sourceIndexOf: number[] = [];\n sourceChars.forEach((ch, i) => {\n // Per-character folding must keep whitespace, otherwise multi-word queries\n // could never match: foldUrdu() trims, and a lone space would fold to \"\".\n const folded = normalizeUrdu(ch, {\n stripDiacritics: true,\n stripZwnj: true,\n collapseWhitespace: false,\n }).toLowerCase();\n for (const f of folded) {\n foldedChars.push(f);\n sourceIndexOf.push(i);\n }\n });\n\n const haystack = foldedChars.join(\"\");\n let out = \"\";\n let cursor = 0; // index into sourceChars\n let from = 0; // index into haystack\n\n for (;;) {\n const hit = haystack.indexOf(foldedQuery, from);\n if (hit === -1) break;\n const startSource = sourceIndexOf[hit]!;\n const endSource = (sourceIndexOf[hit + foldedQuery.length - 1] ?? startSource) + 1;\n out += sourceChars.slice(cursor, startSource).join(\"\");\n out += wrap(sourceChars.slice(startSource, endSource).join(\"\"));\n cursor = endSource;\n from = hit + foldedQuery.length;\n }\n\n out += sourceChars.slice(cursor).join(\"\");\n return out;\n}\n","/**\n * Transliteration between Urdu script and Roman Urdu.\n *\n * Read this before shipping it anywhere user-visible:\n *\n * Urdu script omits short vowels, so the mapping is genuinely ambiguous —\n * کتب is `kitab` or `kutub` depending on context, and no rule table can decide\n * which. The reverse direction is worse, because Roman Urdu has no standard\n * orthography (hai / hay / he / hei all occur in the wild).\n *\n * This module therefore works in two layers: a dictionary of common words, then\n * a rule fallback. Expect roughly 70% word accuracy on ordinary prose from the\n * rule layer, and treat every function here as `@experimental`. Anything better\n * needs a real lexicon plus a statistical model, which is planned for a later\n * release and deliberately not faked here.\n */\nimport { removeDiacritics, normalizeUrdu } from \"./normalize.js\";\nimport { splitWords } from \"./stats.js\";\n\n/** High-frequency words where the rule layer would produce something wrong or unreadable. */\nconst WORD_DICTIONARY: Record<string, string> = {\n \"آپ\": \"aap\",\n \"آپکا\": \"aapka\",\n \"اور\": \"aur\",\n \"ایک\": \"aik\",\n \"احمد\": \"ahmed\",\n \"اچھا\": \"acha\",\n \"بہت\": \"bohat\",\n \"پاکستان\": \"pakistan\",\n \"پانی\": \"paani\",\n \"پر\": \"par\",\n \"پہلا\": \"pehla\",\n \"تم\": \"tum\",\n \"تھا\": \"tha\",\n \"تھی\": \"thi\",\n \"حال\": \"haal\",\n \"خان\": \"khan\",\n \"خوبصورت\": \"khoobsurat\",\n \"دن\": \"din\",\n \"رات\": \"raat\",\n \"زید\": \"zaid\",\n \"سے\": \"se\",\n \"شہر\": \"shehar\",\n \"علی\": \"ali\",\n \"کا\": \"ka\",\n \"کتاب\": \"kitaab\",\n \"کر\": \"kar\",\n \"کرنا\": \"karna\",\n \"کے\": \"ke\",\n \"کی\": \"ki\",\n \"کیا\": \"kya\",\n \"کیسے\": \"kaisay\",\n \"لڑکا\": \"larka\",\n \"لڑکی\": \"larki\",\n \"لیے\": \"liye\",\n \"محمد\": \"muhammad\",\n \"مضمون\": \"mazmoon\",\n \"ملک\": \"mulk\",\n \"میں\": \"mein\",\n \"میرا\": \"mera\",\n \"میری\": \"meri\",\n \"نام\": \"naam\",\n \"نہیں\": \"nahi\",\n \"وہ\": \"woh\",\n \"ہے\": \"hai\",\n \"ہیں\": \"hain\",\n \"ہو\": \"ho\",\n \"ہوں\": \"hoon\",\n \"یہ\": \"yeh\",\n};\n\n/** Consonant + ھ (do-chashmi heh) forms one aspirated sound, so it is matched first. */\nconst DIGRAPHS: Record<string, string> = {\n \"بھ\": \"bh\",\n \"پھ\": \"ph\",\n \"تھ\": \"th\",\n \"ٹھ\": \"th\",\n \"جھ\": \"jh\",\n \"چھ\": \"chh\",\n \"دھ\": \"dh\",\n \"ڈھ\": \"dh\",\n \"ڑھ\": \"rh\",\n \"کھ\": \"kh\",\n \"گھ\": \"gh\",\n \"لھ\": \"lh\",\n \"مھ\": \"mh\",\n \"نھ\": \"nh\",\n \"رھ\": \"rh\",\n};\n\nconst LETTERS: Record<string, string> = {\n \"ا\": \"a\",\n \"آ\": \"aa\",\n \"ب\": \"b\",\n \"پ\": \"p\",\n \"ت\": \"t\",\n \"ٹ\": \"t\",\n \"ث\": \"s\",\n \"ج\": \"j\",\n \"چ\": \"ch\",\n \"ح\": \"h\",\n \"خ\": \"kh\",\n \"د\": \"d\",\n \"ڈ\": \"d\",\n \"ذ\": \"z\",\n \"ر\": \"r\",\n \"ڑ\": \"r\",\n \"ز\": \"z\",\n \"ژ\": \"zh\",\n \"س\": \"s\",\n \"ش\": \"sh\",\n \"ص\": \"s\",\n \"ض\": \"z\",\n \"ط\": \"t\",\n \"ظ\": \"z\",\n \"ع\": \"a\",\n \"غ\": \"gh\",\n \"ف\": \"f\",\n \"ق\": \"q\",\n \"ک\": \"k\",\n \"گ\": \"g\",\n \"ل\": \"l\",\n \"م\": \"m\",\n \"ن\": \"n\",\n \"ں\": \"n\",\n \"و\": \"o\",\n \"ہ\": \"h\",\n \"ھ\": \"h\",\n \"ء\": \"\",\n \"ی\": \"i\",\n \"ئ\": \"i\",\n \"ے\": \"e\",\n \"ۓ\": \"e\",\n \"ؤ\": \"o\",\n \"ۂ\": \"h\",\n};\n\nfunction romanizeWord(word: string): string {\n const dictionary = WORD_DICTIONARY[word];\n if (dictionary) return dictionary;\n\n const chars = [...word];\n let out = \"\";\n for (let i = 0; i < chars.length; i++) {\n const pair = chars[i]! + (chars[i + 1] ?? \"\");\n const digraph = DIGRAPHS[pair];\n if (digraph) {\n out += digraph;\n i++;\n continue;\n }\n const ch = chars[i]!;\n if (i === 0 && ch === \"ا\") {\n // Word-initial alef is a vowel carrier: اسلام -> islam, not aislam.\n const next = chars[1];\n if (next === \"و\") {\n out += \"o\";\n i++;\n continue;\n }\n if (next === \"ی\") {\n out += \"i\";\n i++;\n continue;\n }\n out += \"a\";\n continue;\n }\n out += LETTERS[ch] ?? ch;\n }\n return out;\n}\n\n/**\n * Urdu script -> Roman Urdu.\n *\n * @experimental Rule + dictionary based; see the module note on accuracy.\n * @example\n * romanize(\"آپ کیسے ہیں\") // \"aap kaisay hain\"\n */\nexport function romanize(input: string, options: { capitalize?: boolean } = {}): string {\n if (!input) return \"\";\n const clean = removeDiacritics(normalizeUrdu(input));\n const roman = clean\n .split(/(\\s+)/u)\n .map((chunk) => (/^\\s+$/u.test(chunk) ? chunk : romanizeWord(chunk)))\n .join(\"\");\n if (!options.capitalize) return roman;\n return roman.charAt(0).toUpperCase() + roman.slice(1);\n}\n\n/** Roman spellings seen in the wild, mapped to their Urdu word. */\nconst ROMAN_DICTIONARY: Record<string, string> = {};\nfor (const [urduWord, roman] of Object.entries(WORD_DICTIONARY)) {\n ROMAN_DICTIONARY[roman] = urduWord;\n}\nObject.assign(ROMAN_DICTIONARY, {\n hai: \"ہے\",\n hay: \"ہے\",\n he: \"ہے\",\n hein: \"ہیں\",\n hoon: \"ہوں\",\n hun: \"ہوں\",\n ap: \"آپ\",\n kaise: \"کیسے\",\n kaisa: \"کیسا\",\n nam: \"نام\",\n naam: \"نام\",\n mai: \"میں\",\n main: \"میں\",\n nahin: \"نہیں\",\n kia: \"کیا\",\n bahut: \"بہت\",\n bhot: \"بہت\",\n acha: \"اچھا\",\n achha: \"اچھا\",\n shukriya: \"شکریہ\",\n salam: \"سلام\",\n});\n\nconst ROMAN_RULES: Array<[RegExp, string]> = [\n [/^kh/u, \"کھ\"],\n [/^gh/u, \"گھ\"],\n [/^chh/u, \"چھ\"],\n [/^ch/u, \"چ\"],\n [/^sh/u, \"ش\"],\n [/^th/u, \"تھ\"],\n [/^ph/u, \"پھ\"],\n [/^bh/u, \"بھ\"],\n [/^aa/u, \"آ\"],\n [/^oo/u, \"و\"],\n [/^ee/u, \"ی\"],\n [/^ai/u, \"ی\"],\n [/^b/u, \"ب\"],\n [/^p/u, \"پ\"],\n [/^t/u, \"ت\"],\n [/^j/u, \"ج\"],\n [/^d/u, \"د\"],\n [/^r/u, \"ر\"],\n [/^z/u, \"ز\"],\n [/^s/u, \"س\"],\n [/^f/u, \"ف\"],\n [/^q/u, \"ق\"],\n [/^k/u, \"ک\"],\n [/^g/u, \"گ\"],\n [/^l/u, \"ل\"],\n [/^m/u, \"م\"],\n [/^n/u, \"ن\"],\n [/^v|^w/u, \"و\"],\n [/^h/u, \"ہ\"],\n [/^y/u, \"ی\"],\n [/^a/u, \"ا\"],\n [/^e/u, \"ی\"],\n [/^i/u, \"ی\"],\n [/^o/u, \"و\"],\n [/^u/u, \"و\"],\n];\n\nfunction romanWordToUrdu(word: string): string {\n const lower = word.toLowerCase();\n const dictionary = ROMAN_DICTIONARY[lower];\n if (dictionary) return dictionary;\n\n let rest = lower;\n let out = \"\";\n let position = 0;\n while (rest.length > 0) {\n let matched = false;\n for (const [pattern, replacement] of ROMAN_RULES) {\n const hit = pattern.exec(rest);\n if (!hit) continue;\n // Short vowels are not written inside a word — only word-initially.\n const isShortVowel = /^[aeiou]$/u.test(hit[0]!);\n const skip = isShortVowel && position > 0 && rest.length > 1;\n if (!skip) out += replacement;\n rest = rest.slice(hit[0]!.length);\n position++;\n matched = true;\n break;\n }\n if (!matched) {\n out += rest[0]!;\n rest = rest.slice(1);\n position++;\n }\n }\n return out;\n}\n\n/**\n * Roman Urdu -> Urdu script.\n *\n * @experimental Substantially less accurate than {@link romanize}: Roman Urdu has\n * no standard spelling, so anything outside the dictionary is a guess.\n * @example\n * romanToUrdu(\"mera naam zaid hai\") // \"میرا نام زید ہے\"\n */\nexport function romanToUrdu(input: string): string {\n if (!input) return \"\";\n return input\n .split(/(\\s+)/u)\n .map((chunk) => (/^\\s+$/u.test(chunk) ? chunk : romanWordToUrdu(chunk)))\n .join(\"\");\n}\n\nexport interface SlugOptions {\n /** Word separator. Default `\"-\"`. */\n separator?: string;\n /** Cap the slug length, cutting at a word boundary. */\n maxLength?: number;\n /**\n * Keep Urdu characters instead of transliterating. Produces a percent-encoded\n * but human-readable URL, and avoids the accuracy problem entirely. Default `false`.\n */\n preserveUrdu?: boolean;\n}\n\n/**\n * URL slug from an Urdu title.\n *\n * @experimental in transliterating mode, for the reasons in the module note.\n * Pass `preserveUrdu: true` for a lossless slug.\n *\n * @example\n * urduSlug(\"میرا پہلا مضمون\") // \"mera-pehla-mazmoon\"\n * urduSlug(\"میرا پہلا مضمون\", { preserveUrdu: true }) // \"میرا-پہلا-مضمون\"\n */\nexport function urduSlug(input: string, options: SlugOptions = {}): string {\n const { separator = \"-\", maxLength, preserveUrdu = false } = options;\n if (!input) return \"\";\n\n const words = splitWords(removeDiacritics(normalizeUrdu(input)));\n const parts = preserveUrdu ? words : words.map(romanizeWord);\n\n // Built by joining cleaned tokens rather than by regex, so a caller-supplied\n // separator never has to be escaped into a pattern.\n const allowed = preserveUrdu ? /[^\\p{L}\\p{N}]+/gu : /[^a-z0-9]+/gu;\n let slug = parts\n .map((part) => part.toLowerCase().replace(allowed, \" \").trim())\n .flatMap((part) => part.split(/\\s+/u))\n .filter((part) => part.length > 0)\n .join(separator);\n\n if (maxLength && slug.length > maxLength) {\n slug = slug.slice(0, maxLength);\n const lastSeparator = slug.lastIndexOf(separator);\n if (lastSeparator > 0) slug = slug.slice(0, lastSeparator);\n }\n return slug;\n}\n"]}
@@ -0,0 +1,245 @@
1
+ declare const SETS: {
2
+ readonly urdu: "۰۱۲۳۴۵۶۷۸۹";
3
+ readonly english: "0123456789";
4
+ readonly arabic: "٠١٢٣٤٥٦٧٨٩";
5
+ };
6
+ type DigitStyle = keyof typeof SETS;
7
+ /** `12345` -> `۱۲۳۴۵`. Accepts Arabic-Indic digits as input too. */
8
+ declare function toUrduDigits(input: string): string;
9
+ /** `۱۲۳۴۵` -> `12345`. Safe to feed into `Number()` afterwards. */
10
+ declare function toEnglishDigits(input: string): string;
11
+ /** `۱۲۳۴۵` -> `١٢٣٤٥` (Arabic-Indic, U+0660 block — a different block from Urdu's). */
12
+ declare function toArabicIndicDigits(input: string): string;
13
+ /**
14
+ * Rewrite every digit in `input` to one style.
15
+ *
16
+ * @example
17
+ * convertNumbers("12345") // "۱۲۳۴۵"
18
+ * convertNumbers("۱۲۳۴۵", "english") // "12345"
19
+ */
20
+ declare function convertNumbers(input: string, to?: DigitStyle): string;
21
+ /**
22
+ * Parse a number written with Urdu or Arabic-Indic digits.
23
+ * Handles the Urdu decimal separator ٫ and thousands separator ٬.
24
+ * Returns `NaN` when the string is not a number.
25
+ */
26
+ declare function parseUrduNumber(input: string): number;
27
+ /**
28
+ * Spell a whole number in Urdu words, using the South Asian scale
29
+ * (ہزار, لاکھ, کروڑ, ارب) rather than the western million/billion scale.
30
+ *
31
+ * Coverage note: 21-99 that are not multiples of ten are written compositionally
32
+ * (`اکیس` etc. are irregular in real Urdu, so this returns `بیس ایک`-style forms
33
+ * only as a fallback). Marked experimental for that reason.
34
+ *
35
+ * @experimental
36
+ */
37
+ declare function numberToUrduWords(value: number): string;
38
+
39
+ interface NormalizeOptions {
40
+ /** Apply Unicode NFKC first, folding presentation forms (ﻻ, ﮐ) back to real letters. Default `true`. */
41
+ compatibility?: boolean;
42
+ /** Strip harakat and quranic marks. Default `false` — see {@link removeDiacritics}. */
43
+ stripDiacritics?: boolean;
44
+ /** Remove tatweel/kashida padding. Default `true`. */
45
+ stripTatweel?: boolean;
46
+ /** Remove zero-width non-joiner. Default `false`, since ZWNJ can be meaningful. */
47
+ stripZwnj?: boolean;
48
+ /** Collapse whitespace runs to a single space and trim. Default `true`. */
49
+ collapseWhitespace?: boolean;
50
+ /** Rewrite every digit to one style. Default `"preserve"`. */
51
+ digits?: DigitStyle | "preserve";
52
+ /** Map ASCII `,` `;` `?` to Urdu `،` `؛` `؟`. Default `false`. */
53
+ urduPunctuation?: boolean;
54
+ }
55
+ /**
56
+ * Fold an Urdu string to a single canonical Unicode form.
57
+ *
58
+ * @example
59
+ * normalizeUrdu("كيا حال ہے") // "کیا حال ہے"
60
+ */
61
+ declare function normalizeUrdu(input: string, options?: NormalizeOptions): string;
62
+ /**
63
+ * Strip harakat, quranic annotation marks and superscript alef.
64
+ * Keeps ۔ ے ۓ, which are letters/punctuation rather than marks.
65
+ *
66
+ * @example
67
+ * removeDiacritics("مُحَمَّد") // "محمد"
68
+ */
69
+ declare function removeDiacritics(input: string): string;
70
+ /**
71
+ * The comparison key used by {@link searchUrdu} and {@link sortUrdu}:
72
+ * normalized, diacritic-free, lowercased, whitespace-collapsed.
73
+ * Two strings that a reader would call "the same word" should fold to the same key.
74
+ */
75
+ declare function foldUrdu(input: string): string;
76
+
77
+ interface IsUrduOptions {
78
+ /**
79
+ * Minimum share of Arabic-script letters among all letters, 0-1. Default `0.5`.
80
+ * A ratio rather than "contains any Urdu" so that a mostly-English string with
81
+ * one Urdu word does not count as Urdu.
82
+ */
83
+ threshold?: number;
84
+ /** Require at least this many Arabic-script letters. Default `1`. */
85
+ minLetters?: number;
86
+ }
87
+ /**
88
+ * Ratio of Arabic-script letters to all letters, 0-1.
89
+ * Returns 0 for text with no letters at all (digits, punctuation, emoji).
90
+ */
91
+ declare function urduRatio(input: string): number;
92
+ /**
93
+ * Is this text Urdu (more precisely: predominantly Arabic-script)?
94
+ *
95
+ * The Arabic script is shared by Urdu, Arabic, Persian, Pashto and others, so
96
+ * this cannot distinguish Urdu from Arabic on script alone. Use
97
+ * {@link hasUrduSpecificLetters} when that distinction matters.
98
+ *
99
+ * @example
100
+ * isUrdu("آپ کیسے ہیں؟") // true
101
+ */
102
+ declare function isUrdu(input: string, options?: IsUrduOptions): boolean;
103
+ /**
104
+ * True when the text contains at least one letter that Arabic does not use.
105
+ * Cheap way to separate Urdu/Persian-family text from Arabic text.
106
+ */
107
+ declare function hasUrduSpecificLetters(input: string): boolean;
108
+
109
+ /** Words in the text. Splits on whitespace and punctuation, so `ہے۔` counts once. */
110
+ declare function countWords(input: string): number;
111
+ /** The word list behind {@link countWords}. Useful for tokenizing before search or indexing. */
112
+ declare function splitWords(input: string): string[];
113
+ /** Sentences, split on ۔ ؟ ! . and ellipsis. */
114
+ declare function countSentences(input: string): number;
115
+ declare function splitSentences(input: string): string[];
116
+ interface UrduStats {
117
+ /** Every codepoint, including spaces and diacritics. */
118
+ characters: number;
119
+ charactersNoSpaces: number;
120
+ words: number;
121
+ sentences: number;
122
+ /** Whitespace-delimited blocks separated by a blank line. */
123
+ paragraphs: number;
124
+ /** Share of Arabic-script letters among all letters, 0-100, rounded. */
125
+ urduPercentage: number;
126
+ diacritics: number;
127
+ digits: number;
128
+ averageWordsPerSentence: number;
129
+ /** At 180 Urdu words per minute — slower than English because the script is denser. */
130
+ readingTimeMinutes: number;
131
+ }
132
+ /**
133
+ * Character, word, sentence and script statistics for a block of text.
134
+ *
135
+ * @example
136
+ * analyzeUrdu("پاکستان ایک خوبصورت ملک ہے۔ اس کی آبادی زیادہ ہے۔")
137
+ */
138
+ declare function analyzeUrdu(input: string): UrduStats;
139
+
140
+ /**
141
+ * Comparator for Urdu strings, usable directly in `Array.prototype.sort`.
142
+ * Diacritics and Unicode variants are folded first, so spelling noise does not
143
+ * change the order.
144
+ */
145
+ declare function compareUrdu(a: string, b: string): number;
146
+ interface SortOptions<T> {
147
+ /** Sort descending. Default `false`. */
148
+ descending?: boolean;
149
+ /** Read the sort key out of each item, for sorting objects. */
150
+ getText?: (item: T) => string;
151
+ }
152
+ /**
153
+ * Sort strings in Urdu alphabetical order.
154
+ *
155
+ * @example
156
+ * sortUrdu(["گل", "آم", "بادام"]) // ["آم", "بادام", "گل"]
157
+ */
158
+ declare function sortUrdu<T>(items: readonly T[], options?: SortOptions<T>): T[];
159
+
160
+ interface SearchOptions<T> {
161
+ /** Read the searchable text out of each item, for searching objects. */
162
+ getText?: (item: T) => string;
163
+ /**
164
+ * Allow small spelling differences via edit distance on individual words.
165
+ * Costs O(query x item) per candidate word, so it runs only after the exact
166
+ * substring pass fails. Default `false`.
167
+ */
168
+ fuzzy?: boolean;
169
+ /** Maximum edit distance per word when `fuzzy` is on. Default `1`. */
170
+ maxDistance?: number;
171
+ /** Cap the number of results. */
172
+ limit?: number;
173
+ /** Return matches ordered by score (best first) instead of input order. Default `true`. */
174
+ sortByScore?: boolean;
175
+ }
176
+ interface SearchResult<T> {
177
+ item: T;
178
+ /** 1 = exact fold match, 0.9 = prefix, 0.8 = substring, lower = fuzzy word match. */
179
+ score: number;
180
+ }
181
+ /** Levenshtein distance with early exit once the limit is exceeded. */
182
+ declare function editDistance(a: string, b: string, limit?: number): number;
183
+ /**
184
+ * Search a list of Urdu strings, ignoring diacritics and Unicode variant spellings.
185
+ *
186
+ * Both sides are folded with {@link foldUrdu} first, so `محمد` matches `مُحَمَّد`
187
+ * and Arabic-keyboard `محمد` (with ه/ي) matches Urdu-keyboard `محمد`.
188
+ *
189
+ * @example
190
+ * searchUrdu("محمد", ["مُحَمَّد علی", "احمد", "محمد خان"])
191
+ * // ["مُحَمَّد علی", "محمد خان"]
192
+ */
193
+ declare function searchUrdu<T = string>(query: string, items: readonly T[], options?: SearchOptions<T>): T[];
194
+ /** Same as {@link searchUrdu} but keeps the match scores. */
195
+ declare function searchUrduRanked<T = string>(query: string, items: readonly T[], options?: SearchOptions<T>): Array<SearchResult<T>>;
196
+ /**
197
+ * Highlight every occurrence of `query` in `text` by wrapping it.
198
+ * Matching is diacritic-insensitive, but the returned string keeps the original
199
+ * spelling and diacritics intact — offsets are mapped back to the source.
200
+ */
201
+ declare function highlightUrdu(text: string, query: string, wrap?: (match: string) => string): string;
202
+
203
+ /**
204
+ * Urdu script -> Roman Urdu.
205
+ *
206
+ * @experimental Rule + dictionary based; see the module note on accuracy.
207
+ * @example
208
+ * romanize("آپ کیسے ہیں") // "aap kaisay hain"
209
+ */
210
+ declare function romanize(input: string, options?: {
211
+ capitalize?: boolean;
212
+ }): string;
213
+ /**
214
+ * Roman Urdu -> Urdu script.
215
+ *
216
+ * @experimental Substantially less accurate than {@link romanize}: Roman Urdu has
217
+ * no standard spelling, so anything outside the dictionary is a guess.
218
+ * @example
219
+ * romanToUrdu("mera naam zaid hai") // "میرا نام زید ہے"
220
+ */
221
+ declare function romanToUrdu(input: string): string;
222
+ interface SlugOptions {
223
+ /** Word separator. Default `"-"`. */
224
+ separator?: string;
225
+ /** Cap the slug length, cutting at a word boundary. */
226
+ maxLength?: number;
227
+ /**
228
+ * Keep Urdu characters instead of transliterating. Produces a percent-encoded
229
+ * but human-readable URL, and avoids the accuracy problem entirely. Default `false`.
230
+ */
231
+ preserveUrdu?: boolean;
232
+ }
233
+ /**
234
+ * URL slug from an Urdu title.
235
+ *
236
+ * @experimental in transliterating mode, for the reasons in the module note.
237
+ * Pass `preserveUrdu: true` for a lossless slug.
238
+ *
239
+ * @example
240
+ * urduSlug("میرا پہلا مضمون") // "mera-pehla-mazmoon"
241
+ * urduSlug("میرا پہلا مضمون", { preserveUrdu: true }) // "میرا-پہلا-مضمون"
242
+ */
243
+ declare function urduSlug(input: string, options?: SlugOptions): string;
244
+
245
+ export { type DigitStyle, type IsUrduOptions, type NormalizeOptions, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, foldUrdu, hasUrduSpecificLetters, highlightUrdu, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, toArabicIndicDigits, toEnglishDigits, toUrduDigits, urduRatio, urduSlug };
@@ -0,0 +1,245 @@
1
+ declare const SETS: {
2
+ readonly urdu: "۰۱۲۳۴۵۶۷۸۹";
3
+ readonly english: "0123456789";
4
+ readonly arabic: "٠١٢٣٤٥٦٧٨٩";
5
+ };
6
+ type DigitStyle = keyof typeof SETS;
7
+ /** `12345` -> `۱۲۳۴۵`. Accepts Arabic-Indic digits as input too. */
8
+ declare function toUrduDigits(input: string): string;
9
+ /** `۱۲۳۴۵` -> `12345`. Safe to feed into `Number()` afterwards. */
10
+ declare function toEnglishDigits(input: string): string;
11
+ /** `۱۲۳۴۵` -> `١٢٣٤٥` (Arabic-Indic, U+0660 block — a different block from Urdu's). */
12
+ declare function toArabicIndicDigits(input: string): string;
13
+ /**
14
+ * Rewrite every digit in `input` to one style.
15
+ *
16
+ * @example
17
+ * convertNumbers("12345") // "۱۲۳۴۵"
18
+ * convertNumbers("۱۲۳۴۵", "english") // "12345"
19
+ */
20
+ declare function convertNumbers(input: string, to?: DigitStyle): string;
21
+ /**
22
+ * Parse a number written with Urdu or Arabic-Indic digits.
23
+ * Handles the Urdu decimal separator ٫ and thousands separator ٬.
24
+ * Returns `NaN` when the string is not a number.
25
+ */
26
+ declare function parseUrduNumber(input: string): number;
27
+ /**
28
+ * Spell a whole number in Urdu words, using the South Asian scale
29
+ * (ہزار, لاکھ, کروڑ, ارب) rather than the western million/billion scale.
30
+ *
31
+ * Coverage note: 21-99 that are not multiples of ten are written compositionally
32
+ * (`اکیس` etc. are irregular in real Urdu, so this returns `بیس ایک`-style forms
33
+ * only as a fallback). Marked experimental for that reason.
34
+ *
35
+ * @experimental
36
+ */
37
+ declare function numberToUrduWords(value: number): string;
38
+
39
+ interface NormalizeOptions {
40
+ /** Apply Unicode NFKC first, folding presentation forms (ﻻ, ﮐ) back to real letters. Default `true`. */
41
+ compatibility?: boolean;
42
+ /** Strip harakat and quranic marks. Default `false` — see {@link removeDiacritics}. */
43
+ stripDiacritics?: boolean;
44
+ /** Remove tatweel/kashida padding. Default `true`. */
45
+ stripTatweel?: boolean;
46
+ /** Remove zero-width non-joiner. Default `false`, since ZWNJ can be meaningful. */
47
+ stripZwnj?: boolean;
48
+ /** Collapse whitespace runs to a single space and trim. Default `true`. */
49
+ collapseWhitespace?: boolean;
50
+ /** Rewrite every digit to one style. Default `"preserve"`. */
51
+ digits?: DigitStyle | "preserve";
52
+ /** Map ASCII `,` `;` `?` to Urdu `،` `؛` `؟`. Default `false`. */
53
+ urduPunctuation?: boolean;
54
+ }
55
+ /**
56
+ * Fold an Urdu string to a single canonical Unicode form.
57
+ *
58
+ * @example
59
+ * normalizeUrdu("كيا حال ہے") // "کیا حال ہے"
60
+ */
61
+ declare function normalizeUrdu(input: string, options?: NormalizeOptions): string;
62
+ /**
63
+ * Strip harakat, quranic annotation marks and superscript alef.
64
+ * Keeps ۔ ے ۓ, which are letters/punctuation rather than marks.
65
+ *
66
+ * @example
67
+ * removeDiacritics("مُحَمَّد") // "محمد"
68
+ */
69
+ declare function removeDiacritics(input: string): string;
70
+ /**
71
+ * The comparison key used by {@link searchUrdu} and {@link sortUrdu}:
72
+ * normalized, diacritic-free, lowercased, whitespace-collapsed.
73
+ * Two strings that a reader would call "the same word" should fold to the same key.
74
+ */
75
+ declare function foldUrdu(input: string): string;
76
+
77
+ interface IsUrduOptions {
78
+ /**
79
+ * Minimum share of Arabic-script letters among all letters, 0-1. Default `0.5`.
80
+ * A ratio rather than "contains any Urdu" so that a mostly-English string with
81
+ * one Urdu word does not count as Urdu.
82
+ */
83
+ threshold?: number;
84
+ /** Require at least this many Arabic-script letters. Default `1`. */
85
+ minLetters?: number;
86
+ }
87
+ /**
88
+ * Ratio of Arabic-script letters to all letters, 0-1.
89
+ * Returns 0 for text with no letters at all (digits, punctuation, emoji).
90
+ */
91
+ declare function urduRatio(input: string): number;
92
+ /**
93
+ * Is this text Urdu (more precisely: predominantly Arabic-script)?
94
+ *
95
+ * The Arabic script is shared by Urdu, Arabic, Persian, Pashto and others, so
96
+ * this cannot distinguish Urdu from Arabic on script alone. Use
97
+ * {@link hasUrduSpecificLetters} when that distinction matters.
98
+ *
99
+ * @example
100
+ * isUrdu("آپ کیسے ہیں؟") // true
101
+ */
102
+ declare function isUrdu(input: string, options?: IsUrduOptions): boolean;
103
+ /**
104
+ * True when the text contains at least one letter that Arabic does not use.
105
+ * Cheap way to separate Urdu/Persian-family text from Arabic text.
106
+ */
107
+ declare function hasUrduSpecificLetters(input: string): boolean;
108
+
109
+ /** Words in the text. Splits on whitespace and punctuation, so `ہے۔` counts once. */
110
+ declare function countWords(input: string): number;
111
+ /** The word list behind {@link countWords}. Useful for tokenizing before search or indexing. */
112
+ declare function splitWords(input: string): string[];
113
+ /** Sentences, split on ۔ ؟ ! . and ellipsis. */
114
+ declare function countSentences(input: string): number;
115
+ declare function splitSentences(input: string): string[];
116
+ interface UrduStats {
117
+ /** Every codepoint, including spaces and diacritics. */
118
+ characters: number;
119
+ charactersNoSpaces: number;
120
+ words: number;
121
+ sentences: number;
122
+ /** Whitespace-delimited blocks separated by a blank line. */
123
+ paragraphs: number;
124
+ /** Share of Arabic-script letters among all letters, 0-100, rounded. */
125
+ urduPercentage: number;
126
+ diacritics: number;
127
+ digits: number;
128
+ averageWordsPerSentence: number;
129
+ /** At 180 Urdu words per minute — slower than English because the script is denser. */
130
+ readingTimeMinutes: number;
131
+ }
132
+ /**
133
+ * Character, word, sentence and script statistics for a block of text.
134
+ *
135
+ * @example
136
+ * analyzeUrdu("پاکستان ایک خوبصورت ملک ہے۔ اس کی آبادی زیادہ ہے۔")
137
+ */
138
+ declare function analyzeUrdu(input: string): UrduStats;
139
+
140
+ /**
141
+ * Comparator for Urdu strings, usable directly in `Array.prototype.sort`.
142
+ * Diacritics and Unicode variants are folded first, so spelling noise does not
143
+ * change the order.
144
+ */
145
+ declare function compareUrdu(a: string, b: string): number;
146
+ interface SortOptions<T> {
147
+ /** Sort descending. Default `false`. */
148
+ descending?: boolean;
149
+ /** Read the sort key out of each item, for sorting objects. */
150
+ getText?: (item: T) => string;
151
+ }
152
+ /**
153
+ * Sort strings in Urdu alphabetical order.
154
+ *
155
+ * @example
156
+ * sortUrdu(["گل", "آم", "بادام"]) // ["آم", "بادام", "گل"]
157
+ */
158
+ declare function sortUrdu<T>(items: readonly T[], options?: SortOptions<T>): T[];
159
+
160
+ interface SearchOptions<T> {
161
+ /** Read the searchable text out of each item, for searching objects. */
162
+ getText?: (item: T) => string;
163
+ /**
164
+ * Allow small spelling differences via edit distance on individual words.
165
+ * Costs O(query x item) per candidate word, so it runs only after the exact
166
+ * substring pass fails. Default `false`.
167
+ */
168
+ fuzzy?: boolean;
169
+ /** Maximum edit distance per word when `fuzzy` is on. Default `1`. */
170
+ maxDistance?: number;
171
+ /** Cap the number of results. */
172
+ limit?: number;
173
+ /** Return matches ordered by score (best first) instead of input order. Default `true`. */
174
+ sortByScore?: boolean;
175
+ }
176
+ interface SearchResult<T> {
177
+ item: T;
178
+ /** 1 = exact fold match, 0.9 = prefix, 0.8 = substring, lower = fuzzy word match. */
179
+ score: number;
180
+ }
181
+ /** Levenshtein distance with early exit once the limit is exceeded. */
182
+ declare function editDistance(a: string, b: string, limit?: number): number;
183
+ /**
184
+ * Search a list of Urdu strings, ignoring diacritics and Unicode variant spellings.
185
+ *
186
+ * Both sides are folded with {@link foldUrdu} first, so `محمد` matches `مُحَمَّد`
187
+ * and Arabic-keyboard `محمد` (with ه/ي) matches Urdu-keyboard `محمد`.
188
+ *
189
+ * @example
190
+ * searchUrdu("محمد", ["مُحَمَّد علی", "احمد", "محمد خان"])
191
+ * // ["مُحَمَّد علی", "محمد خان"]
192
+ */
193
+ declare function searchUrdu<T = string>(query: string, items: readonly T[], options?: SearchOptions<T>): T[];
194
+ /** Same as {@link searchUrdu} but keeps the match scores. */
195
+ declare function searchUrduRanked<T = string>(query: string, items: readonly T[], options?: SearchOptions<T>): Array<SearchResult<T>>;
196
+ /**
197
+ * Highlight every occurrence of `query` in `text` by wrapping it.
198
+ * Matching is diacritic-insensitive, but the returned string keeps the original
199
+ * spelling and diacritics intact — offsets are mapped back to the source.
200
+ */
201
+ declare function highlightUrdu(text: string, query: string, wrap?: (match: string) => string): string;
202
+
203
+ /**
204
+ * Urdu script -> Roman Urdu.
205
+ *
206
+ * @experimental Rule + dictionary based; see the module note on accuracy.
207
+ * @example
208
+ * romanize("آپ کیسے ہیں") // "aap kaisay hain"
209
+ */
210
+ declare function romanize(input: string, options?: {
211
+ capitalize?: boolean;
212
+ }): string;
213
+ /**
214
+ * Roman Urdu -> Urdu script.
215
+ *
216
+ * @experimental Substantially less accurate than {@link romanize}: Roman Urdu has
217
+ * no standard spelling, so anything outside the dictionary is a guess.
218
+ * @example
219
+ * romanToUrdu("mera naam zaid hai") // "میرا نام زید ہے"
220
+ */
221
+ declare function romanToUrdu(input: string): string;
222
+ interface SlugOptions {
223
+ /** Word separator. Default `"-"`. */
224
+ separator?: string;
225
+ /** Cap the slug length, cutting at a word boundary. */
226
+ maxLength?: number;
227
+ /**
228
+ * Keep Urdu characters instead of transliterating. Produces a percent-encoded
229
+ * but human-readable URL, and avoids the accuracy problem entirely. Default `false`.
230
+ */
231
+ preserveUrdu?: boolean;
232
+ }
233
+ /**
234
+ * URL slug from an Urdu title.
235
+ *
236
+ * @experimental in transliterating mode, for the reasons in the module note.
237
+ * Pass `preserveUrdu: true` for a lossless slug.
238
+ *
239
+ * @example
240
+ * urduSlug("میرا پہلا مضمون") // "mera-pehla-mazmoon"
241
+ * urduSlug("میرا پہلا مضمون", { preserveUrdu: true }) // "میرا-پہلا-مضمون"
242
+ */
243
+ declare function urduSlug(input: string, options?: SlugOptions): string;
244
+
245
+ export { type DigitStyle, type IsUrduOptions, type NormalizeOptions, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, foldUrdu, hasUrduSpecificLetters, highlightUrdu, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, toArabicIndicDigits, toEnglishDigits, toUrduDigits, urduRatio, urduSlug };