UNPKG

urdu-text-utils

Version:

Comprehensive Urdu NLP & text processing toolkit: normalization, Roman Urdu transliteration, stop words, script detection, digits, diacritics (aerab), sorting, search, and statistics. Zero dependencies, ESM + CJS.

40 lines (39 loc) • 1.45 kB
/** * 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. */ export declare const URDU_STOP_WORDS: Set<string>; /** * 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 */ export declare function isStopWord(word: string, customStopWords?: Set<string> | 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(["یہ", "ایک", "اچھی", "کتاب", "ہے"]) // ["اچھی", "کتاب"] */ export declare function filterStopWords(words: string[], customStopWords?: Set<string> | 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("یہ ایک بہترین کتاب ہے") // "بہترین کتاب" */ export declare function removeStopWords(text: string, customStopWords?: Set<string> | string[]): string;