urdu-text-utils 0.2.2 → 0.3.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.
- package/CHANGELOG.md +16 -0
- package/README.md +12 -1
- package/dist/index.cjs +9 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.d.cts
CHANGED
|
@@ -114,6 +114,8 @@ interface SplitSentenceOptions {
|
|
|
114
114
|
/** If true, the sentence-ending punctuation (۔ ؟ ! . etc.) is preserved with each sentence. Default `false`. */
|
|
115
115
|
preserveTerminators?: boolean;
|
|
116
116
|
}
|
|
117
|
+
/** Common Urdu abbreviations and honorifics that should not cause false sentence splits. */
|
|
118
|
+
declare const SENTENCE_ABBREVIATIONS: string[];
|
|
117
119
|
/**
|
|
118
120
|
* Sentences count, split on Urdu and standard terminators (۔ ؟ ! . …).
|
|
119
121
|
* Protects common titles, abbreviations, and numeric decimals from false splits.
|
|
@@ -406,6 +408,11 @@ declare const URDU_PREFIXES: readonly ["غیر", "خود", "اہل", "بے", "ن
|
|
|
406
408
|
* Canonical Urdu suffixes (لاحقے) ordered by descending length.
|
|
407
409
|
*/
|
|
408
410
|
declare const URDU_SUFFIXES: readonly ["یںگے", "ینگے", "ےگا", "ےگی", "ینگی", "داری", "گاری", "کاری", "سازی", "بازی", "مندی", "ترین", "ستان", "خانہ", "نامہ", "جات", "گان", "دار", "گار", "کار", "ساز", "باز", "مند", "ناک", "وار", "دان", "زار", "یت", "پن", "ائی", "تر", "یاں", "ئیں", "ؤں", "یوں", "وں", "یں", "ات", "ہا", "ین", "تیں", "تا", "تی", "تے", "نا"];
|
|
411
|
+
/**
|
|
412
|
+
* Irreducible base words that must not have prefixes or suffixes stripped falsely.
|
|
413
|
+
* Exported so the PHP port can consume the identical list via tables.json.
|
|
414
|
+
*/
|
|
415
|
+
declare const PROTECTED_WORDS: Set<string>;
|
|
409
416
|
interface StemmerOptions {
|
|
410
417
|
/**
|
|
411
418
|
* Whether to strip canonical Urdu prefixes (e.g. بے-, نا-, غیر-, لا-).
|
|
@@ -454,8 +461,11 @@ interface AffixBreakdown {
|
|
|
454
461
|
* getAffixes("کتابیں")
|
|
455
462
|
* // { stem: "کتاب", suffix: "یں" }
|
|
456
463
|
*
|
|
464
|
+
* getAffixes("غیرملکیوں")
|
|
465
|
+
* // { prefix: "غیر", stem: "ملکی", suffix: "یوں" }
|
|
466
|
+
*
|
|
457
467
|
* getAffixes("نااہلی")
|
|
458
|
-
* // { prefix: "نا", stem: "
|
|
468
|
+
* // { prefix: "نا", stem: "اہلی" }
|
|
459
469
|
*/
|
|
460
470
|
declare function getAffixes(input: string, options?: StemmerOptions): AffixBreakdown;
|
|
461
471
|
/**
|
|
@@ -483,6 +493,20 @@ declare function stemUrdu(word: string, options?: StemmerOptions): string;
|
|
|
483
493
|
*/
|
|
484
494
|
declare function stemUrduText(text: string, options?: StemmerOptions): string;
|
|
485
495
|
|
|
496
|
+
/** Common Urdu first names mapped to their standard English spellings. */
|
|
497
|
+
declare const URDU_FIRST_NAMES: Record<string, string>;
|
|
498
|
+
/** Common Urdu family/last names mapped to their standard English spellings. */
|
|
499
|
+
declare const URDU_FAMILY_NAMES: Record<string, string>;
|
|
500
|
+
/** Honorific titles used in Urdu names. */
|
|
501
|
+
declare const HONORIFICS: Record<string, string>;
|
|
502
|
+
/** Name prefixes that are kept in both languages. */
|
|
503
|
+
declare const NAME_PREFIXES: Record<string, string>;
|
|
504
|
+
/**
|
|
505
|
+
* Alternate English spellings of names already in the forward tables
|
|
506
|
+
* (e.g. `Omar` for عمر, canonically spelled `Umar` in English).
|
|
507
|
+
* Exported so the PHP port can consume the identical list via tables.json.
|
|
508
|
+
*/
|
|
509
|
+
declare const ENGLISH_NAME_ALIASES: Record<string, string>;
|
|
486
510
|
interface NameTransliterationOptions {
|
|
487
511
|
/** Preserve the original case of the English name. Default: true (capitalized). */
|
|
488
512
|
preserveCase?: boolean;
|
|
@@ -519,4 +543,4 @@ declare function extractNameParts(fullName: string): {
|
|
|
519
543
|
suffix?: string;
|
|
520
544
|
};
|
|
521
545
|
|
|
522
|
-
export { type AffixBreakdown, type DigitStyle, type FormatUrduDateOptions, type IsUrduOptions, type NameTransliterationOptions, type NormalizeOptions, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type SplitSentenceOptions, type StemmerOptions, type TimeAgoOptions, URDU_MONTHS_GREGORIAN, URDU_MONTHS_HIJRI, URDU_PREFIXES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_WEEKDAYS, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduDate, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };
|
|
546
|
+
export { type AffixBreakdown, type DigitStyle, ENGLISH_NAME_ALIASES, type FormatUrduDateOptions, HONORIFICS, type IsUrduOptions, NAME_PREFIXES, type NameTransliterationOptions, type NormalizeOptions, PROTECTED_WORDS, 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_PREFIXES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_WEEKDAYS, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduDate, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };
|
package/dist/index.d.ts
CHANGED
|
@@ -114,6 +114,8 @@ interface SplitSentenceOptions {
|
|
|
114
114
|
/** If true, the sentence-ending punctuation (۔ ؟ ! . etc.) is preserved with each sentence. Default `false`. */
|
|
115
115
|
preserveTerminators?: boolean;
|
|
116
116
|
}
|
|
117
|
+
/** Common Urdu abbreviations and honorifics that should not cause false sentence splits. */
|
|
118
|
+
declare const SENTENCE_ABBREVIATIONS: string[];
|
|
117
119
|
/**
|
|
118
120
|
* Sentences count, split on Urdu and standard terminators (۔ ؟ ! . …).
|
|
119
121
|
* Protects common titles, abbreviations, and numeric decimals from false splits.
|
|
@@ -406,6 +408,11 @@ declare const URDU_PREFIXES: readonly ["غیر", "خود", "اہل", "بے", "ن
|
|
|
406
408
|
* Canonical Urdu suffixes (لاحقے) ordered by descending length.
|
|
407
409
|
*/
|
|
408
410
|
declare const URDU_SUFFIXES: readonly ["یںگے", "ینگے", "ےگا", "ےگی", "ینگی", "داری", "گاری", "کاری", "سازی", "بازی", "مندی", "ترین", "ستان", "خانہ", "نامہ", "جات", "گان", "دار", "گار", "کار", "ساز", "باز", "مند", "ناک", "وار", "دان", "زار", "یت", "پن", "ائی", "تر", "یاں", "ئیں", "ؤں", "یوں", "وں", "یں", "ات", "ہا", "ین", "تیں", "تا", "تی", "تے", "نا"];
|
|
411
|
+
/**
|
|
412
|
+
* Irreducible base words that must not have prefixes or suffixes stripped falsely.
|
|
413
|
+
* Exported so the PHP port can consume the identical list via tables.json.
|
|
414
|
+
*/
|
|
415
|
+
declare const PROTECTED_WORDS: Set<string>;
|
|
409
416
|
interface StemmerOptions {
|
|
410
417
|
/**
|
|
411
418
|
* Whether to strip canonical Urdu prefixes (e.g. بے-, نا-, غیر-, لا-).
|
|
@@ -454,8 +461,11 @@ interface AffixBreakdown {
|
|
|
454
461
|
* getAffixes("کتابیں")
|
|
455
462
|
* // { stem: "کتاب", suffix: "یں" }
|
|
456
463
|
*
|
|
464
|
+
* getAffixes("غیرملکیوں")
|
|
465
|
+
* // { prefix: "غیر", stem: "ملکی", suffix: "یوں" }
|
|
466
|
+
*
|
|
457
467
|
* getAffixes("نااہلی")
|
|
458
|
-
* // { prefix: "نا", stem: "
|
|
468
|
+
* // { prefix: "نا", stem: "اہلی" }
|
|
459
469
|
*/
|
|
460
470
|
declare function getAffixes(input: string, options?: StemmerOptions): AffixBreakdown;
|
|
461
471
|
/**
|
|
@@ -483,6 +493,20 @@ declare function stemUrdu(word: string, options?: StemmerOptions): string;
|
|
|
483
493
|
*/
|
|
484
494
|
declare function stemUrduText(text: string, options?: StemmerOptions): string;
|
|
485
495
|
|
|
496
|
+
/** Common Urdu first names mapped to their standard English spellings. */
|
|
497
|
+
declare const URDU_FIRST_NAMES: Record<string, string>;
|
|
498
|
+
/** Common Urdu family/last names mapped to their standard English spellings. */
|
|
499
|
+
declare const URDU_FAMILY_NAMES: Record<string, string>;
|
|
500
|
+
/** Honorific titles used in Urdu names. */
|
|
501
|
+
declare const HONORIFICS: Record<string, string>;
|
|
502
|
+
/** Name prefixes that are kept in both languages. */
|
|
503
|
+
declare const NAME_PREFIXES: Record<string, string>;
|
|
504
|
+
/**
|
|
505
|
+
* Alternate English spellings of names already in the forward tables
|
|
506
|
+
* (e.g. `Omar` for عمر, canonically spelled `Umar` in English).
|
|
507
|
+
* Exported so the PHP port can consume the identical list via tables.json.
|
|
508
|
+
*/
|
|
509
|
+
declare const ENGLISH_NAME_ALIASES: Record<string, string>;
|
|
486
510
|
interface NameTransliterationOptions {
|
|
487
511
|
/** Preserve the original case of the English name. Default: true (capitalized). */
|
|
488
512
|
preserveCase?: boolean;
|
|
@@ -519,4 +543,4 @@ declare function extractNameParts(fullName: string): {
|
|
|
519
543
|
suffix?: string;
|
|
520
544
|
};
|
|
521
545
|
|
|
522
|
-
export { type AffixBreakdown, type DigitStyle, type FormatUrduDateOptions, type IsUrduOptions, type NameTransliterationOptions, type NormalizeOptions, type SearchOptions, type SearchResult, type SlugOptions, type SortOptions, type SplitSentenceOptions, type StemmerOptions, type TimeAgoOptions, URDU_MONTHS_GREGORIAN, URDU_MONTHS_HIJRI, URDU_PREFIXES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_WEEKDAYS, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduDate, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };
|
|
546
|
+
export { type AffixBreakdown, type DigitStyle, ENGLISH_NAME_ALIASES, type FormatUrduDateOptions, HONORIFICS, type IsUrduOptions, NAME_PREFIXES, type NameTransliterationOptions, type NormalizeOptions, PROTECTED_WORDS, 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_PREFIXES, URDU_STOP_WORDS, URDU_SUFFIXES, URDU_WEEKDAYS, type UrduStats, analyzeUrdu, compareUrdu, convertNumbers, countSentences, countWords, editDistance, extractNameParts, filterStopWords, foldUrdu, formatUrduDate, getAffixes, getUrduMonthName, getUrduWeekdayName, hasUrduSpecificLetters, highlightUrdu, isStopWord, isUrdu, normalizeUrdu, numberToUrduWords, parseUrduNumber, removeDiacritics, removeStopWords, romanToUrdu, romanize, searchUrdu, searchUrduRanked, sortUrdu, splitSentences, splitWords, stemUrdu, stemUrduText, timeAgoUrdu, toArabicIndicDigits, toEnglishDigits, toUrduDigits, transliterateNameToEnglish, transliterateNameToUrdu, urduRatio, urduSlug };
|