urdu-text-utils 0.1.8 → 0.1.10-alpha.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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9
4
+
5
+ - Add rule-based Urdu Stemmer module (`stemUrdu`, `stemUrduText`, `getAffixes`).
6
+ - Add morphological restorations for feminine plurals (*لڑکیاں* → *لڑکی*), hamza plurals (*دعاؤں* → *دعا*), and Arabic/sound plurals (*تعلیمات* → *تعلیم*).
7
+ - Add canonical prefix and suffix stripping with short root protection and exception handling.
8
+ - Add canonical constants `URDU_PREFIXES` and `URDU_SUFFIXES`.
9
+
3
10
  ## 0.1.8
4
11
 
5
12
  - Fix jsDelivr monthly hit badge in README to use shields.io SVG endpoint.
package/README.md CHANGED
@@ -53,6 +53,8 @@ import {
53
53
  removeStopWords,
54
54
  formatUrduDate,
55
55
  timeAgoUrdu,
56
+ stemUrdu,
57
+ stemUrduText,
56
58
  isUrdu,
57
59
  countWords,
58
60
  splitSentences,
@@ -172,6 +174,31 @@ timeAgoUrdu(Date.now() - 2 * 86400 * 1000);// "پرسوں"
172
174
  timeAgoUrdu(Date.now() + 10 * 60 * 1000); // "۱۰ منٹ بعد"
173
175
  ```
174
176
 
177
+ ## Urdu stemming
178
+
179
+ Rule-based stemmer and affix stripper with morphological vowel/letter restorations:
180
+
181
+ ```ts
182
+ import { stemUrdu, stemUrduText } from "urdu-text-utils";
183
+
184
+ // Plurals & morphological restoration
185
+ stemUrdu("کتابیں"); // "کتاب"
186
+ stemUrdu("لڑکیاں"); // "لڑکی" (restores final ی)
187
+ stemUrdu("کہانیاں"); // "کہانی"
188
+ stemUrdu("دعاؤں"); // "دعا"
189
+ stemUrdu("خوشبوئیں"); // "خوشبو"
190
+
191
+ // Prefixes & derivational suffixes
192
+ stemUrdu("بےوقوف"); // "وقوف"
193
+ stemUrdu("نااہل"); // "اہل"
194
+ stemUrdu("دکاندار"); // "دکان"
195
+ stemUrdu("مددگار"); // "مدد"
196
+
197
+ // Stems full text while preserving layout & punctuation
198
+ stemUrduText("طلباء کتابیں پڑھتے ہیں اور کہانیاں سنتے ہیں۔");
199
+ // "طلباء کتاب پڑھ ہیں اور کہانی سن ہیں۔"
200
+ ```
201
+
175
202
  ## Diacritics
176
203
 
177
204
  ```ts