declare const SETS: { readonly urdu: "۰۱۲۳۴۵۶۷۸۹"; readonly english: "0123456789"; readonly arabic: "٠١٢٣٤٥٦٧٨٩"; }; type DigitStyle = keyof typeof SETS; /** `12345` -> `۱۲۳۴۵`. Accepts Arabic-Indic digits as input too. */ declare function toUrduDigits(input: string): string; /** `۱۲۳۴۵` -> `12345`. Safe to feed into `Number()` afterwards. */ declare function toEnglishDigits(input: string): string; /** `۱۲۳۴۵` -> `١٢٣٤٥` (Arabic-Indic, U+0660 block — a different block from Urdu's). */ declare function toArabicIndicDigits(input: string): string; /** * Rewrite every digit in `input` to one style. * * @example * convertNumbers("12345") // "۱۲۳۴۵" * convertNumbers("۱۲۳۴۵", "english") // "12345" */ declare function convertNumbers(input: string, to?: DigitStyle): string; /** * Parse a number written with Urdu or Arabic-Indic digits. * Handles the Urdu decimal separator ٫ and thousands separator ٬. * Returns `NaN` when the string is not a number. */ declare function parseUrduNumber(input: string): number; /** Cardinal words for 0-9. Index 0 is empty: `0` is spelled `صفر` separately. */ declare const URDU_ONES: readonly string[]; /** Words for 10-20 plus every multiple of ten through 100. */ declare const URDU_TEENS_AND_TENS: Readonly>; /** * The 21-99 values that are irregular: Urdu does not compose them as * "twenty-one", each unit has its own word. Every non-multiple of ten from 21 * to 99 appears here exactly once. * * A few of these spellings have documented variants (`26` also appears as * `چھببیس`; `92` as `بیانوے`). This table follows the standard textbook forms. */ declare const URDU_TENS_UNITS: Readonly>; /** * The South Asian scale, largest first. `کھرب` is 10^11 and `ارب` is 10^9 — * note they are not the western billion/trillion, and each step below `کروڑ` * is two orders of magnitude, not three. */ declare const URDU_SCALES: ReadonlyArray; /** * Ordinals 1-6 are irregular; every larger ordinal is the last word of the * cardinal with `واں` (masculine) or `ویں` (feminine) attached. */ declare const URDU_ORDINAL_IRREGULARS: Readonly>; /** * Spell a whole number in Urdu words, using the South Asian scale * (ہزار, لاکھ, کروڑ, ارب, کھرب) rather than the western million/billion scale. * * Every cardinal from 0 to 99 is a real irregular word — 21 is `اکیس`, not a * composed `بیس ایک` — and the scale words are exact up to 10^15, beyond which * JavaScript's own floating-point representation loses precision. * * @experimental The irregular 21-99 word table is transcribed from standard * textbook forms; a handful of those words have recognised variant spellings. * * @example * numberToUrduWords(1234567) // "بارہ لاکھ چونتیس ہزار پانچ سو سڑسٹھ" * numberToUrduWords(1e9) // "ایک ارب" */ declare function numberToUrduWords(value: number): string; interface FormatUrduNumberOptions { /** * Digit block to emit. The separators follow it: Urdu digits pair with ٬/٫, * English digits with `,`/`.`. * @default "urdu" */ digits?: "urdu" | "english"; /** * `"southAsian"` groups as lakh/crore (12٬34٬567), `"western"` as thousands * (1٬234٬567), `"none"` emits no separators. * @default "southAsian" */ grouping?: "southAsian" | "western" | "none"; /** * Fraction digits, rounded half-up. Trailing zeros are dropped, so a whole * number never grows a decimal separator. * * Rounding is applied to the binary double, not to its decimal spelling, and * both language ports do the arithmetic identically. That keeps output * byte-identical between them, and it means values whose decimal form is not * exactly representable (2.675, 1.005) can round down rather than up. Asking * for many digits exposes the representation itself: 1234567.891 at * `decimals: 15` ends in the double's real binary noise. Keep this at 6 or * below for display; `decimalPlaces`-style rounding of exact decimals is out * of scope. * @default 2 */ decimals?: number; } /** * Format a number the way Urdu software prints numbers, with South Asian * digit grouping and Urdu digits by default. * * Returns `""` for `NaN` and infinities, matching `formatUrduDate`. * * A very large magnitude prints the shortest decimal that represents the * double, so beyond 2^53 the digits are the value the number really holds. * * @example * formatUrduNumber(1234567) // "۱۲٬۳۴٬۵۶۷" * formatUrduNumber(1234567, { grouping: "western" }) // "۱٬۲۳۴٬۵۶۷" * formatUrduNumber(1234, { digits: "english" }) // "1,234" * formatUrduNumber(-3.14159, { decimals: 3 }) // "-۳٫۱۴۲" */ declare function formatUrduNumber(value: number, options?: FormatUrduNumberOptions): string; interface FormatUrduCurrencyOptions extends FormatUrduNumberOptions { /** * `"digits"` prints the amount as a formatted number, `"words"` spells it out. * @default "digits" */ style?: "digits" | "words"; /** Unit used for every amount except exactly one. @default "روپے" */ unit?: string; /** Unit used for an amount of exactly one. @default "روپیہ" */ singularUnit?: string; } /** * Format a money amount with the right Urdu unit for the quantity. * * @experimental The `"words"` style inherits the note on * {@link numberToUrduWords}, and like it requires a whole amount. * * @example * formatUrduCurrency(1500) // "۱٬۵۰۰ روپے" * formatUrduCurrency(1) // "۱ روپیہ" * formatUrduCurrency(1500, { style: "words" }) // "ایک ہزار پانچ سو روپے" * formatUrduCurrency(2.5, { unit: "ڈالر", singularUnit: "ڈالر" }) // "۲٫۵ ڈالر" */ declare function formatUrduCurrency(value: number, options?: FormatUrduCurrencyOptions): string; interface UrduOrdinalOptions { /** * Urdu ordinals inflect for gender: `پہلا` (masculine) vs `پہلی` (feminine). * @default "masculine" */ gender?: "masculine" | "feminine"; } /** * Spell an ordinal in Urdu — `پہلا`, `دوسرا`, `اکیسواں`, `سواں`. * * 1-6 are irregular and come from a table; everything else is the last word of * the cardinal with the ordinal suffix, so `اکیس` becomes `اکیسواں` and `نوے` * becomes `نوےواں`. A word-final `و` contracts instead of doubling, which is * why `نو` becomes `نواں` (not `نوواں`) and `سو` becomes `سواں`. * * `0` returns `صفر`, since "zeroth" has no Urdu ordinal form. Returns `""` for * non-finite input and throws for fractions, like {@link numberToUrduWords}. * * @experimental Inherits the note on {@link numberToUrduWords}. * * @example * toUrduOrdinal(1) // "پہلا" * toUrduOrdinal(1, { gender: "feminine" }) // "پہلی" * toUrduOrdinal(9) // "نواں" * toUrduOrdinal(21) // "اکیسواں" * toUrduOrdinal(100) // "سواں" * toUrduOrdinal(1100, { gender: "feminine" }) // "ایک ہزار ایک سویں" */ declare function toUrduOrdinal(value: number, options?: UrduOrdinalOptions): string; interface NormalizeOptions { /** Apply Unicode NFKC first, folding presentation forms (ﻻ, ﮐ) back to real letters. Default `true`. */ compatibility?: boolean; /** Strip harakat and quranic marks. Default `false` — see {@link removeDiacritics}. */ stripDiacritics?: boolean; /** Remove tatweel/kashida padding. Default `true`. */ stripTatweel?: boolean; /** Remove zero-width non-joiner. Default `false`, since ZWNJ can be meaningful. */ stripZwnj?: boolean; /** Collapse whitespace runs to a single space and trim. Default `true`. */ collapseWhitespace?: boolean; /** Rewrite every digit to one style. Default `"preserve"`. */ digits?: DigitStyle | "preserve"; /** Map ASCII `,` `;` `?` to Urdu `،` `؛` `؟`. Default `false`. */ urduPunctuation?: boolean; } /** * Fold an Urdu string to a single canonical Unicode form. * * @example * normalizeUrdu("كيا حال ہے") // "کیا حال ہے" */ declare function normalizeUrdu(input: string, options?: NormalizeOptions): string; /** * Strip harakat, quranic annotation marks and superscript alef. * Keeps ۔ ے ۓ, which are letters/punctuation rather than marks. * * @example * removeDiacritics("مُحَمَّد") // "محمد" */ declare function removeDiacritics(input: string): string; /** * The comparison key used by {@link searchUrdu} and {@link sortUrdu}: * normalized, diacritic-free, lowercased, whitespace-collapsed. * Two strings that a reader would call "the same word" should fold to the same key. */ declare function foldUrdu(input: string): string; interface IsUrduOptions { /** * Minimum share of Arabic-script letters among all letters, 0-1. Default `0.5`. * A ratio rather than "contains any Urdu" so that a mostly-English string with * one Urdu word does not count as Urdu. */ threshold?: number; /** Require at least this many Arabic-script letters. Default `1`. */ minLetters?: number; } /** * Ratio of Arabic-script letters to all letters, 0-1. * Returns 0 for text with no letters at all (digits, punctuation, emoji). */ declare function urduRatio(input: string): number; /** * Is this text Urdu (more precisely: predominantly Arabic-script)? * * The Arabic script is shared by Urdu, Arabic, Persian, Pashto and others, so * this cannot distinguish Urdu from Arabic on script alone. Use * {@link hasUrduSpecificLetters} when that distinction matters. * * @example * isUrdu("آپ کیسے ہیں؟") // true */ declare function isUrdu(input: string, options?: IsUrduOptions): boolean; /** * True when the text contains at least one letter that Arabic does not use. * Cheap way to separate Urdu/Persian-family text from Arabic text. */ declare function hasUrduSpecificLetters(input: string): boolean; /** Words in the text. Splits on whitespace and punctuation, so `ہے۔` counts once. */ declare function countWords(input: string): number; /** The word list behind {@link countWords}. Useful for tokenizing before search or indexing. */ declare function splitWords(input: string): string[]; interface SplitSentenceOptions { /** If true, the sentence-ending punctuation (۔ ؟ ! . etc.) is preserved with each sentence. Default `false`. */ preserveTerminators?: boolean; } /** Common Urdu abbreviations and honorifics that should not cause false sentence splits. */ declare const SENTENCE_ABBREVIATIONS: string[]; /** * Sentences count, split on Urdu and standard terminators (۔ ؟ ! . …). * Protects common titles, abbreviations, and numeric decimals from false splits. */ declare function countSentences(input: string, options?: SplitSentenceOptions): number; /** * Split text into sentences using Urdu punctuation rules. * * Handles Urdu full stop `۔`, Arabic question mark `؟`, exclamation `!`, * ASCII `.`, `?`, `!`, and ellipses `…`, while protecting abbreviations and numbers. * * @param input - Input text. * @param options - Options controlling termination preservation. * * @example * splitSentences("پاکستان ایک خوبصورت ملک ہے۔ اس کی تاریخ پرانی ہے۔") * // ["پاکستان ایک خوبصورت ملک ہے", "اس کی تاریخ پرانی ہے"] */ declare function splitSentences(input: string, options?: SplitSentenceOptions): string[]; interface UrduStats { /** Every codepoint, including spaces and diacritics. */ characters: number; charactersNoSpaces: number; words: number; sentences: number; /** Whitespace-delimited blocks separated by a blank line. */ paragraphs: number; /** Share of Arabic-script letters among all letters, 0-100, rounded. */ urduPercentage: number; diacritics: number; digits: number; averageWordsPerSentence: number; /** At 180 Urdu words per minute — slower than English because the script is denser. */ readingTimeMinutes: number; } /** * Character, word, sentence and script statistics for a block of text. * * @example * analyzeUrdu("پاکستان ایک خوبصورت ملک ہے۔ اس کی آبادی زیادہ ہے۔") */ declare function analyzeUrdu(input: string): UrduStats; /** * Standard list of Urdu stop words. * * Covers pronouns, postpositions, auxiliaries, conjunctions, particles, * and high-frequency functional words used across Urdu texts. * All keys are canonical normalized Urdu. */ declare const URDU_STOP_WORDS: Set; /** * Checks if a given Urdu word is a stop word. * * @param word - Word to test. * @param customStopWords - Optional custom stop words set or array. Defaults to {@link URDU_STOP_WORDS}. * * @example * isStopWord("اور") // true * isStopWord("کتاب") // false */ declare function isStopWord(word: string, customStopWords?: Set | string[]): boolean; /** * Filters out stop words from an array of words. * * @param words - Array of words to filter. * @param customStopWords - Optional custom stop words set or array. * * @example * filterStopWords(["یہ", "ایک", "اچھی", "کتاب", "ہے"]) // ["اچھی", "کتاب"] */ declare function filterStopWords(words: string[], customStopWords?: Set | string[]): string[]; /** * Removes stop words from an Urdu text string, returning the cleaned text. * * @param text - Input Urdu text. * @param customStopWords - Optional custom stop words set or array. * * @example * removeStopWords("یہ ایک بہترین کتاب ہے") // "بہترین کتاب" */ declare function removeStopWords(text: string, customStopWords?: Set | string[]): string; /** * Comparator for Urdu strings, usable directly in `Array.prototype.sort`. * Diacritics and Unicode variants are folded first, so spelling noise does not * change the order. */ declare function compareUrdu(a: string, b: string): number; interface SortOptions { /** Sort descending. Default `false`. */ descending?: boolean; /** Read the sort key out of each item, for sorting objects. */ getText?: (item: T) => string; } /** * Sort strings in Urdu alphabetical order. * * @example * sortUrdu(["گل", "آم", "بادام"]) // ["آم", "بادام", "گل"] */ declare function sortUrdu(items: readonly T[], options?: SortOptions): T[]; interface SearchOptions { /** Read the searchable text out of each item, for searching objects. */ getText?: (item: T) => string; /** * Allow small spelling differences via edit distance on individual words. * Costs O(query x item) per candidate word, so it runs only after the exact * substring pass fails. Default `false`. */ fuzzy?: boolean; /** Maximum edit distance per word when `fuzzy` is on. Default `1`. */ maxDistance?: number; /** Cap the number of results. */ limit?: number; /** Return matches ordered by score (best first) instead of input order. Default `true`. */ sortByScore?: boolean; } interface SearchResult { item: T; /** 1 = exact fold match, 0.9 = prefix, 0.8 = substring, lower = fuzzy word match. */ score: number; } /** Levenshtein distance with early exit once the limit is exceeded. */ declare function editDistance(a: string, b: string, limit?: number): number; /** * Search a list of Urdu strings, ignoring diacritics and Unicode variant spellings. * * Both sides are folded with {@link foldUrdu} first, so `محمد` matches `مُحَمَّد` * and Arabic-keyboard `محمد` (with ه/ي) matches Urdu-keyboard `محمد`. * * @example * searchUrdu("محمد", ["مُحَمَّد علی", "احمد", "محمد خان"]) * // ["مُحَمَّد علی", "محمد خان"] */ declare function searchUrdu(query: string, items: readonly T[], options?: SearchOptions): T[]; /** Same as {@link searchUrdu} but keeps the match scores. */ declare function searchUrduRanked(query: string, items: readonly T[], options?: SearchOptions): Array>; /** * Highlight every occurrence of `query` in `text` by wrapping it. * Matching is diacritic-insensitive, but the returned string keeps the original * spelling and diacritics intact — offsets are mapped back to the source. */ declare function highlightUrdu(text: string, query: string, wrap?: (match: string) => string): string; /** * Urdu script -> Roman Urdu. * * @experimental Rule + dictionary based; see the module note on accuracy. * @example * romanize("آپ کیسے ہیں") // "aap kaisay hain" */ declare function romanize(input: string, options?: { capitalize?: boolean; }): string; /** * Roman Urdu -> Urdu script. * * @experimental Substantially less accurate than {@link romanize}: Roman Urdu has * no standard spelling, so anything outside the dictionary is a guess. * @example * romanToUrdu("mera naam zaid hai") // "میرا نام زید ہے" */ declare function romanToUrdu(input: string): string; interface SlugOptions { /** Word separator. Default `"-"`. */ separator?: string; /** Cap the slug length, cutting at a word boundary. */ maxLength?: number; /** * Keep Urdu characters instead of transliterating. Produces a percent-encoded * but human-readable URL, and avoids the accuracy problem entirely. Default `false`. */ preserveUrdu?: boolean; } /** * URL slug from an Urdu title. * * @experimental in transliterating mode, for the reasons in the module note. * Pass `preserveUrdu: true` for a lossless slug. * * @example * urduSlug("میرا پہلا مضمون") // "mera-pehla-mazmoon" * urduSlug("میرا پہلا مضمون", { preserveUrdu: true }) // "میرا-پہلا-مضمون" */ declare function urduSlug(input: string, options?: SlugOptions): string; /** * Gregorian month names in Urdu (standard literary transliterations). * Index 0 corresponds to January (جنوری). */ declare const URDU_MONTHS_GREGORIAN: readonly ["جنوری", "فروری", "مارچ", "اپریل", "مئی", "جون", "جولائی", "اگست", "ستمبر", "اکتوبر", "نومبر", "دسمبر"]; /** * Islamic (Hijri) month names in Urdu. * Index 0 corresponds to Muharram (محرم). */ declare const URDU_MONTHS_HIJRI: readonly ["محرم", "صفر", "ربیع الاول", "ربیع الثانی", "جمادی الاول", "جمادی الثانی", "رجب", "شعبان", "رمضان المبارک", "شوال", "ذی القعدہ", "ذی الحجہ"]; /** * Days of the week in Urdu. * Index 0 corresponds to Sunday (اتوار). */ declare const URDU_WEEKDAYS: readonly ["اتوار", "پیر", "منگل", "بدھ", "جمعرات", "جمعہ", "ہفتہ"]; interface FormatUrduDateOptions { /** * Digit style to use for numeric tokens (e.g. YYYY, MM, DD, HH, mm, ss). * @default "urdu" */ digits?: "urdu" | "english"; /** * Calendar month naming scheme to use for `MMMM` and `MMM`. * @default "gregorian" */ calendar?: "gregorian" | "hijri"; } interface TimeAgoOptions { /** * Digit style to use for counts (e.g. "۵ منٹ پہلے" vs "5 منٹ پہلے"). * @default "urdu" */ digits?: "urdu" | "english"; /** * Whether to include the relative suffix/prefix ("پہلے" or "بعد"). * When `false`, returns only the duration string (e.g. "۵ منٹ", "ایک گھنٹہ"). * @default true */ addSuffix?: boolean; } /** * Returns the Urdu name for a given month index (0 to 11). * * @param monthIndex - 0 for January / Muharram, 11 for December / Dhul Hijjah. * @param calendar - "gregorian" or "hijri". Default is "gregorian". */ declare function getUrduMonthName(monthIndex: number, calendar?: "gregorian" | "hijri"): string; /** * Returns the Urdu name for a day of the week (0 = Sunday, 6 = Saturday). */ declare function getUrduWeekdayName(dayIndex: number): string; /** * Formats a Date object or timestamp into an Urdu formatted date string. * * Supported formatting tokens: * - `YYYY`: Full year (e.g. "۲۰۲۶") * - `YY`: Two-digit year (e.g. "۲۶") * - `MMMM`: Full Urdu month name (e.g. "اگست") * - `MMM`: Full Urdu month name (e.g. "اگست") * - `MM`: 2-digit month with leading zero (e.g. "۰۸") * - `M`: 1-digit month (e.g. "۸") * - `DD`: 2-digit day of month with leading zero (e.g. "۰۵") * - `D`: 1-digit day of month (e.g. "۵") * - `dddd`: Full day of the week (e.g. "ہفتہ", "جمعہ") * - `ddd`: Short day of the week (same in Urdu) * - `HH`: 24-hour hour with leading zero (00-23) * - `H`: 24-hour hour (0-23) * - `hh`: 12-hour hour with leading zero (01-12) * - `h`: 12-hour hour (1-12) * - `mm`: Minute with leading zero (00-59) * - `m`: Minute (0-59) * - `ss`: Second with leading zero (00-59) * - `s`: Second (0-59) * - `A`: Day period indicator in Urdu ("صبح", "دوپہر", "شام", "رات") * - `a`: Concise period indicator ("صبح", "شام") * * @example * formatUrduDate(new Date(2026, 7, 22), "DD MMMM YYYY") * // "۲۲ اگست ۲۰۲۶" * * formatUrduDate(new Date(2026, 7, 22, 14, 30), "dddd، D MMMM YYYY، hh:mm A") * // "ہفتہ، ۲۲ اگست ۲۰۲۶، ۰۲:۳۰ دوپہر" */ declare function formatUrduDate(date: Date | string | number, pattern?: string, options?: FormatUrduDateOptions): string; /** * Returns a human-friendly relative time string in Urdu. * * @example * timeAgoUrdu(Date.now() - 30 * 1000) // "ابھی" * timeAgoUrdu(Date.now() - 5 * 60 * 1000) // "۵ منٹ پہلے" * timeAgoUrdu(Date.now() - 3 * 3600 * 1000) // "۳ گھنٹے پہلے" * timeAgoUrdu(Date.now() - 86400 * 1000) // "کل" * timeAgoUrdu(Date.now() + 5 * 60 * 1000) // "۵ منٹ بعد" */ declare function timeAgoUrdu(date: Date | string | number, relativeTo?: Date | string | number, options?: TimeAgoOptions): string; interface ParseUrduDateOptions { /** * Year assumed when the input carries no year, e.g. `۲۲ اگست`. * @default the current year */ defaultYear?: number; } /** * Parse a date written with Urdu or English month names, Urdu or ASCII digits, * into a `Date`. This is the inverse of {@link formatUrduDate}, so anything * that function can produce parses back to the same wall-clock moment: * * ```ts * const d = new Date(2026, 7, 22, 14, 30); * const text = formatUrduDate(d, "dddd، D MMMM YYYY، hh:mm A"); // "ہفتہ، ۲۲ اگست ۲۰۲۶، ۰۲:۳۰ دوپہر" * parseUrduDate(text)?.getHours(); // 14 * ``` * * Accepted input: * - `۲۲ اگست ۲۰۲۶`, `22 August 2026`, `Aug 22, 2026` (Urdu or English month name) * - `۲۲/۰۸/۲۰۲۶` — day-first, matching Pakistani convention * - `2026-08-22` and `2026-08-22T14:30` — ISO, `` `T` `` form, no timezone offset * - an optional preceding weekday name (ignored) and an optional time with * `صبح دوپہر شام رات` or `am`/`pm`, e.g. `۰۲:۳۰ دوپہر` * * Deliberately rejected, returning `null`: absolute instants carrying a `Z` or * numeric offset (this function never does timezone conversion — it builds the * wall-clock time in the runtime's own zone, exactly as `formatUrduDate` * reads it), Hijri month names, and dates that do not exist (`۳۱ فروری`). * A two-digit year expands as `00-69` -> `20xx` and `70-99` -> `19xx`. * * @example * parseUrduDate("۲۲ اگست ۲۰۲۶") // Date(2026, 7, 22) * parseUrduDate("۵ جنوری ۲۰۲۶، ۰۹:۱۵ صبح")?.getHours() // 9 * parseUrduDate("5 جنوری") // Date(currentYear, 0, 5) * parseUrduDate("۳۱ فروری ۲۰۲۶") // null */ declare function parseUrduDate(input: string, options?: ParseUrduDateOptions): Date | null; /** * Canonical Urdu prefixes (سابقے) ordered by descending length. */ declare const URDU_PREFIXES: readonly ["غیر", "خود", "اہل", "بے", "نا", "لا", "بد", "کم", "ان", "ہم", "با", "پُر"]; /** * Canonical Urdu suffixes (لاحقے) ordered by descending length. */ declare const URDU_SUFFIXES: readonly ["یںگے", "ینگے", "ےگا", "ےگی", "ینگی", "داری", "گاری", "کاری", "سازی", "بازی", "مندی", "ترین", "ستان", "خانہ", "نامہ", "جات", "گان", "دار", "گار", "کار", "ساز", "باز", "مند", "ناک", "وار", "دان", "زار", "یت", "پن", "ائی", "تر", "یاں", "ئیں", "ؤں", "یوں", "وں", "یں", "ات", "ہا", "ین", "تیں", "تا", "تی", "تے", "نا"]; /** * Irreducible base words that must not have prefixes or suffixes stripped falsely. * Exported so the PHP port can consume the identical list via tables.json. */ declare const PROTECTED_WORDS: Set; interface StemmerOptions { /** * Whether to strip canonical Urdu prefixes (e.g. بے-, نا-, غیر-, لا-). * @default true */ stripPrefixes?: boolean; /** * Whether to strip canonical Urdu suffixes (e.g. -وں, -یں, -یاں, -دار, -تے). * @default true */ stripSuffixes?: boolean; /** * Minimum character length of the remaining root word. * Prevents over-stemming of short roots. * @default 2 */ minStemLength?: number; /** * Custom list of prefixes to strip in addition to or in place of defaults. */ customPrefixes?: string[]; /** * Custom list of suffixes to strip in addition to or in place of defaults. */ customSuffixes?: string[]; /** * Map of exact exception words to their canonical stems. */ exceptions?: Record; } interface AffixBreakdown { /** The stripped prefix, if any */ prefix?: string; /** The stemmed base root */ stem: string; /** The stripped suffix, if any */ suffix?: string; } /** * Analyzes an Urdu word and extracts its prefix, stem, and suffix. * * @example * getAffixes("بےوقوف") * // { prefix: "بے", stem: "وقوف" } * * getAffixes("کتابیں") * // { stem: "کتاب", suffix: "یں" } * * getAffixes("غیرملکیوں") * // { prefix: "غیر", stem: "ملکی", suffix: "یوں" } * * getAffixes("نااہلی") * // { prefix: "نا", stem: "اہلی" } */ declare function getAffixes(input: string, options?: StemmerOptions): AffixBreakdown; /** * Reduces an Urdu word to its morphological root/stem by stripping common prefixes, * plurals, tense inflections, and adjectival/nominal suffixes. * * @example * stemUrdu("کتابیں") // "کتاب" * stemUrdu("لڑکیاں") // "لڑکی" * stemUrdu("دعاؤں") // "دعا" * stemUrdu("بےوقوف") // "وقوف" * stemUrdu("نااہل") // "اہل" * stemUrdu("خوبصورت ترین") // "خوبصورت" */ declare function stemUrdu(word: string, options?: StemmerOptions): string; /** * Stems all words within a block of Urdu text while preserving punctuation, * whitespaces, and document formatting. * * Ideal for search engine indexing, TF-IDF scoring, and AI/LLM embeddings preprocessing. * * @example * stemUrduText("طلباء کتابیں پڑھتے ہیں اور کہانیاں سنتے ہیں۔") * // "طلباء کتاب پڑھ ہیں اور کہانی سن ہیں۔" */ declare function stemUrduText(text: string, options?: StemmerOptions): string; /** Common Urdu first names mapped to their standard English spellings. */ declare const URDU_FIRST_NAMES: Record; /** Common Urdu family/last names mapped to their standard English spellings. */ declare const URDU_FAMILY_NAMES: Record; /** Honorific titles used in Urdu names. */ declare const HONORIFICS: Record; /** Name prefixes that are kept in both languages. */ declare const NAME_PREFIXES: Record; /** * Alternate English spellings of names already in the forward tables * (e.g. `Omar` for عمر, canonically spelled `Umar` in English). * Exported so the PHP port can consume the identical list via tables.json. */ declare const ENGLISH_NAME_ALIASES: Record; interface NameTransliterationOptions { /** Preserve the original case of the English name. Default: true (capitalized). */ preserveCase?: boolean; /** Include honorifics in the output. Default: true. */ includeHonorifics?: boolean; } /** * Transliterate an Urdu name to English. * * @example * transliterateNameToEnglish("محمد علی") // "Muhammad Ali" * transliterateNameToEnglish("جناب خان صاحب") // "Janab Khan Sahib" */ declare function transliterateNameToEnglish(urduName: string, options?: NameTransliterationOptions): string; /** * Transliterate an English name to Urdu script. * * @example * transliterateNameToUrdu("Muhammad Ali") // "محمد علی" * transliterateNameToUrdu("Janab Khan Sahib") // "جناب خان صاحب" */ declare function transliterateNameToUrdu(englishName: string): string; /** * Extract name parts from a full Urdu name. * * @example * extractNameParts("جناب محمد علی خان صاحب") * // { honorific: "جناب", firstName: "محمد علی", familyName: "خان", suffix: "صاحب" } */ declare function extractNameParts(fullName: string): { honorific?: string; firstName: string; familyName?: string; suffix?: string; }; export { type AffixBreakdown, type DigitStyle, ENGLISH_NAME_ALIASES, type FormatUrduCurrencyOptions, type FormatUrduDateOptions, type FormatUrduNumberOptions, HONORIFICS, type IsUrduOptions, NAME_PREFIXES, type NameTransliterationOptions, type NormalizeOptions, PROTECTED_WORDS, type ParseUrduDateOptions, SENTENCE_ABBREVIATIONS, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type SplitSentenceOptions, type StemmerOptions, type TimeAgoOptions, URDU_FAMILY_NAMES, URDU_FIRST_NAMES, URDU_MONTHS_GREGORIAN, URDU_MONTHS_HIJRI, URDU_ONES, URDU_ORDINAL_IRREGULARS, URDU_PREFIXES, URDU_SCALES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_TEENS_AND_TENS, URDU_TENS_UNITS, URDU_WEEKDAYS, type UrduOrdinalOptions, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduCurrency, formatUrduDate, formatUrduNumber, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduDate, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, toUrduOrdinal, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };