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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ - Complete the PHP port (stages 0.2-0.4): add Detect.php, StopWords.php, Words.php sentence/statistics APIs, Stemmer.php, Date.php and Names.php with full fixture parity against the TypeScript source
6
+ - Flow every shared table (stop words, sentence abbreviations, stemmer affixes, date names, name tables) through the generated php/data/tables.json
7
+ - Export PROTECTED_WORDS and ENGLISH_NAME_ALIASES from the TypeScript source and re-export them from the package root
8
+ - Add 360 PHP parity fixtures (536 PHPUnit tests) that pass with and without ext-intl
9
+ - Add scripts/verify-php-parity.mjs, a no-PHP smoke check mirroring the PHP algorithms in Node
10
+ - Use timezone-stable date fixtures so CI regeneration can never drift from locally generated fixtures
11
+
12
+
13
+ ## 0.2.3
14
+
15
+ - Add Complementary libraries section
16
+ - Keep the UMD build out of bundler ESM resolution
17
+
18
+
3
19
  ## 0.2.2
4
20
 
5
21
  - Smoke-test the release tarball before and after publish
package/README.md CHANGED
@@ -8,6 +8,7 @@
8
8
  [![dependencies](https://img.shields.io/badge/dependencies-0-157f52?style=flat-square)](https://www.npmjs.com/package/urdu-text-utils?activeTab=dependencies)
9
9
  [![downloads](https://img.shields.io/npm/dm/urdu-text-utils?style=flat-square)](https://www.npmjs.com/package/urdu-text-utils)
10
10
  [![license](https://img.shields.io/npm/l/urdu-text-utils?style=flat-square)](./LICENSE)
11
+ ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/Zaid-maker/urdu-text-utils?utm_source=oss&utm_medium=github&utm_campaign=Zaid-maker%2Furdu-text-utils&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews)
11
12
 
12
13
  A complete, lightweight **Urdu text processing toolkit for JavaScript and TypeScript** (Node.js, Deno, Bun, and browsers). Zero runtime dependencies. Provides Unicode normalization, Roman Urdu transliteration, Urdu stop words, script detection, Urdu digit conversion, diacritics (aerab / harakat) removal, alphabetical collation / sorting, fuzzy search, and text statistics.
13
14
 
@@ -278,7 +279,17 @@ For permanent URLs prefer `preserveUrdu: true` (percent-encoded but readable and
278
279
 
279
280
  ## Notes on scope
280
281
 
281
- Every function is pure, synchronous and side-effect free. Nothing here does word segmentation of run-together text, stemming, POS tagging or spell correction; those need a lexicon and are out of scope for this version.
282
+ Every function is pure, synchronous and side-effect free. Nothing here does word segmentation of run-together text, POS tagging or spell correction; those need a lexicon and are out of scope for this version.
283
+
284
+ ## Complementary libraries
285
+
286
+ Urdu tooling is a small ecosystem, and these independent projects cover parts of the pipeline this library deliberately does not:
287
+
288
+ - [UrduMagic](https://github.com/asad7coder/urdumagic) — offline, whole-site English ⇄ Urdu ⇄ Roman Urdu translation with RTL switching and SSR/Next.js helpers, powered by a 10,000+ entry dictionary.
289
+ - [Urduify](https://github.com/zohaibadnan137/urduify) — Roman Urdu ⇄ Urdu translator built on a 16,000-pair word dictionary.
290
+ - [Roman Urdu → Urdu Transliterator](https://github.com/spyhunk/romanUrdu2UrduTranslitration) — fast browser/API Roman-Urdu → Urdu conversion with longest-match matching (MIT).
291
+
292
+ urdu-text-utils owns the text-processing layer (normalization, search, sorting, numbers, dates); pair it with one of the above when you need whole-site translation, a broader lexicon, or Roman-Urdu → Urdu conversion tuned for real-time input.
282
293
 
283
294
  ## Development
284
295
 
package/dist/index.cjs CHANGED
@@ -314,7 +314,7 @@ function splitWords(input) {
314
314
  if (!input) return [];
315
315
  return input.split(WORD_SPLIT_RE).map((w) => w.trim()).filter((w) => w.length > 0);
316
316
  }
317
- var ABBREVIATIONS = [
317
+ var SENTENCE_ABBREVIATIONS = [
318
318
  "\u0688\u0627\u06A9\u0679\u0631",
319
319
  "\u067E\u0631\u0648\u0641\u06CC\u0633\u0631",
320
320
  "\u0627\u0646\u062C\u06CC\u0646\u0626\u0631",
@@ -338,7 +338,7 @@ var ABBREVIATIONS = [
338
338
  "\u0635\u0644\u06CC",
339
339
  "\u0648\u0633\u0644\u0645"
340
340
  ];
341
- var ABBREV_PATTERN = new RegExp(`(?:${ABBREVIATIONS.join("|")})[.\u06D4]`, "gu");
341
+ var ABBREV_PATTERN = new RegExp(`(?:${SENTENCE_ABBREVIATIONS.join("|")})[.\u06D4]`, "gu");
342
342
  function countSentences(input, options) {
343
343
  return splitSentences(input, options).length;
344
344
  }
@@ -4712,6 +4712,13 @@ function extractNameParts(fullName) {
4712
4712
  return { honorific, firstName, familyName, suffix };
4713
4713
  }
4714
4714
 
4715
+ exports.ENGLISH_NAME_ALIASES = ENGLISH_NAME_ALIASES;
4716
+ exports.HONORIFICS = HONORIFICS;
4717
+ exports.NAME_PREFIXES = NAME_PREFIXES;
4718
+ exports.PROTECTED_WORDS = PROTECTED_WORDS;
4719
+ exports.SENTENCE_ABBREVIATIONS = SENTENCE_ABBREVIATIONS;
4720
+ exports.URDU_FAMILY_NAMES = URDU_FAMILY_NAMES;
4721
+ exports.URDU_FIRST_NAMES = URDU_FIRST_NAMES;
4715
4722
  exports.URDU_MONTHS_GREGORIAN = URDU_MONTHS_GREGORIAN;
4716
4723
  exports.URDU_MONTHS_HIJRI = URDU_MONTHS_HIJRI;
4717
4724
  exports.URDU_PREFIXES = URDU_PREFIXES;