urdu-text-utils 0.1.4 → 0.1.6

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,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.6
4
+
5
+ - Add dedicated minified IIFE browser bundle (`dist/index.iife.js`) exposing `window.UrduTextUtils` for seamless jsDelivr and unpkg CDN usage without a bundler.
6
+ - Add `jsdelivr` and `unpkg` fields and `browser` export condition in `package.json`.
7
+
8
+ ## 0.1.5
9
+
10
+ - Expand transliteration dictionary to 1,700+ entries across classical/poetic register, commerce & digital terminology, law & governance, geography, and rich verbal inflections.
11
+ - Expand `ROMAN_VARIANTS` with popular Roman Urdu texting and chat conventions (`kidhr`, `thek`, `sahi`, `behtareen`, `mashaallah`, `jazakallah`, etc.).
12
+ - Add automated sitemap generation, OpenGraph metadata, and JSON-LD structured data for docs.
13
+
3
14
  ## 0.1.4
4
15
 
5
16
  - Add Urdu stop words module (`URDU_STOP_WORDS`, `isStopWord`, `filterStopWords`, `removeStopWords`) with a curated set of 130+ canonical functional words.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # urdu-text-utils
1
+ # urdu-text-utils — Urdu Text Processing Toolkit for JavaScript & TypeScript
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/urdu-text-utils?style=flat-square&color=157f52&label=npm)](https://www.npmjs.com/package/urdu-text-utils)
4
4
  [![CI](https://img.shields.io/github/actions/workflow/status/Zaid-maker/urdu-text-utils/ci.yml?branch=main&style=flat-square&label=CI)](https://github.com/Zaid-maker/urdu-text-utils/actions/workflows/ci.yml)
@@ -7,9 +7,9 @@
7
7
  [![downloads](https://img.shields.io/npm/dm/urdu-text-utils?style=flat-square)](https://www.npmjs.com/package/urdu-text-utils)
8
8
  [![license](https://img.shields.io/npm/l/urdu-text-utils?style=flat-square)](./LICENSE)
9
9
 
10
- Urdu text processing toolkit for JavaScript and TypeScript. Normalization, detection, digits, diacritics, collation, search, statistics and transliteration.
10
+ 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.
11
11
 
12
- Zero runtime dependencies. ESM + CJS. Ships its own types.
12
+ Zero runtime dependencies. ESM + CJS. Fully typed.
13
13
 
14
14
  **[Documentation and live playground →](https://zaid-maker.github.io/urdu-text-utils/)**
15
15
 
@@ -17,11 +17,41 @@ Zero runtime dependencies. ESM + CJS. Ships its own types.
17
17
  npm install urdu-text-utils
18
18
  ```
19
19
 
20
+ ### CDN (Browser / Vanilla JS)
21
+
22
+ You can use `urdu-text-utils` directly in the browser without any bundler or build step via **jsDelivr** or **unpkg**:
23
+
24
+ ```html
25
+ <!-- jsDelivr (global UrduTextUtils) -->
26
+ <script src="https://cdn.jsdelivr.net/npm/urdu-text-utils/dist/index.iife.js"></script>
27
+
28
+ <script>
29
+ const { normalizeUrdu, romanize, isStopWord, searchUrdu } = window.UrduTextUtils;
30
+ console.log(normalizeUrdu("كيا حال ہے")); // "کیا حال ہے"
31
+ </script>
32
+ ```
33
+
34
+ Or as an ES Module:
35
+
36
+ ```html
37
+ <script type="module">
38
+ import { normalizeUrdu, romanize } from "https://cdn.jsdelivr.net/npm/urdu-text-utils/+esm";
39
+ console.log(normalizeUrdu("كيا حال ہے"));
40
+ </script>
41
+ ```
42
+
43
+
20
44
  ```ts
21
45
  import {
22
46
  normalizeUrdu,
47
+ romanize,
48
+ romanToUrdu,
49
+ urduSlug,
50
+ isStopWord,
51
+ removeStopWords,
23
52
  isUrdu,
24
53
  countWords,
54
+ splitSentences,
25
55
  convertNumbers,
26
56
  removeDiacritics,
27
57
  sortUrdu,
package/dist/index.cjs CHANGED
@@ -2885,7 +2885,191 @@ var WORD_DICTIONARY = {
2885
2885
  "\u0641\u0631\u0632\u0627\u0646\u06C1": "farzana",
2886
2886
  "\u0637\u0627\u06C1\u0631\u06C1": "tahira",
2887
2887
  "\u0639\u0635\u0645\u062A": "ismat",
2888
- "\u0646\u0635\u0631\u062A": "nusrat"
2888
+ "\u0646\u0635\u0631\u062A": "nusrat",
2889
+ // ---- classical, poetic and literary vocabulary ----
2890
+ "\u06AF\u0644\u0633\u062A\u0627\u06BA": "gulistan",
2891
+ "\u06AF\u0644\u0634\u0646": "gulshan",
2892
+ "\u0628\u06C1\u0627\u0631\u0627\u06BA": "baharan",
2893
+ "\u067E\u0631\u0648\u0627\u0646\u06C1": "parwana",
2894
+ "\u0634\u0645\u0639": "shama",
2895
+ "\u0633\u0627\u0642\u06CC": "saqi",
2896
+ "\u0645\u06CC\u062E\u0627\u0646\u06C1": "maikhana",
2897
+ "\u062C\u0627\u0645": "jaam",
2898
+ "\u0635\u0631\u0627\u062D\u06CC": "surahi",
2899
+ "\u0631\u0646\u062F": "rind",
2900
+ "\u0645\u062D\u062A\u0633\u0628": "muhtasib",
2901
+ "\u0642\u0627\u0635\u062F": "qasid",
2902
+ "\u067E\u06CC\u0627\u0645\u0628\u0631": "payambar",
2903
+ "\u0631\u0642\u06CC\u0628": "raqeeb",
2904
+ "\u062D\u0628\u06CC\u0628": "habeeb",
2905
+ "\u0645\u062D\u0628\u0648\u0628": "mahboob",
2906
+ "\u0645\u0639\u0634\u0648\u0642": "mashooq",
2907
+ "\u0635\u0646\u0645": "sanam",
2908
+ "\u0633\u0646\u06AF\u062F\u0644": "sangdil",
2909
+ "\u0628\u06CC\u062F\u0631\u062F": "bedard",
2910
+ "\u063A\u0645\u06AF\u0633\u0627\u0631": "ghamgusar",
2911
+ "\u0645\u0633\u06CC\u062D\u0627": "maseeha",
2912
+ "\u0646\u0627\u0635\u062D": "nasih",
2913
+ "\u0648\u0627\u0639\u0638": "waiz",
2914
+ "\u062A\u0634\u0646\u06C1": "tishna",
2915
+ "\u06AF\u06CC\u0633\u0648": "gesu",
2916
+ "\u0632\u0644\u0641": "zulf",
2917
+ "\u062F\u06CC\u062F\u0627\u0631": "deedar",
2918
+ "\u062C\u0644\u0648\u06C1": "jalwa",
2919
+ "\u062D\u062C\u0627\u0628": "hijab",
2920
+ "\u0646\u0642\u0627\u0628": "niqab",
2921
+ "\u0633\u0648\u0632": "soz",
2922
+ "\u0622\u06C1\u0646\u06AF": "aahang",
2923
+ "\u0646\u063A\u0645\u06C1": "naghma",
2924
+ "\u062A\u0631\u0627\u0646\u06C1": "tarana",
2925
+ "\u062F\u0627\u0633\u062A\u0627\u06BA": "dastan",
2926
+ "\u062D\u0648\u0631": "hoor",
2927
+ "\u067E\u0631\u06CC": "pari",
2928
+ "\u062F\u06CC\u0648": "deo",
2929
+ "\u062C\u0627\u062F\u0648": "jadoo",
2930
+ "\u0637\u0644\u0633\u0645": "tilism",
2931
+ "\u0627\u0641\u0633\u0648\u0646": "afsoon",
2932
+ "\u0633\u062D\u0631\u0627\u0646\u06AF\u06CC\u0632": "sehrangeez",
2933
+ "\u0641\u0633\u0648\u06BA": "fusoon",
2934
+ "\u062C\u0646\u0648\u06BA": "junoon",
2935
+ "\u0633\u0648\u062F\u0627": "sauda",
2936
+ "\u0648\u062D\u0634\u062A": "wahshat",
2937
+ "\u0627\u0631\u0645\u0627\u0646": "arman",
2938
+ "\u0630\u0648\u0642": "zauq",
2939
+ "\u0648\u062C\u062F": "wajd",
2940
+ "\u0645\u0633\u062A\u06CC": "masti",
2941
+ "\u06A9\u06CC\u0641": "kaif",
2942
+ "\u062E\u0645\u0627\u0631": "khumar",
2943
+ "\u0646\u0634\u06C1": "nasha",
2944
+ "\u0628\u06D2\u062E\u0648\u062F\u06CC": "bekhudi",
2945
+ // ---- commerce, finance and modern technology ----
2946
+ "\u062E\u0631\u06CC\u062F\u0627\u0631\u06CC": "khareedari",
2947
+ "\u0641\u0631\u0648\u062E\u062A": "farokht",
2948
+ "\u0633\u0631\u0645\u0627\u06CC\u06C1": "sarmaya",
2949
+ "\u0642\u0631\u0636\u06C1": "qarza",
2950
+ "\u0628\u06CC\u0646\u06A9\u0627\u0631\u06CC": "bainkari",
2951
+ "\u0642\u0633\u0637": "qist",
2952
+ "\u0627\u062F\u0627\u0626\u06CC\u06AF\u06CC": "adaigi",
2953
+ "\u0622\u0645\u062F\u0646\u06CC": "aamdani",
2954
+ "\u062E\u0631\u0686\u06C1": "kharcha",
2955
+ "\u0628\u0686\u062A": "bachat",
2956
+ "\u0645\u062D\u0635\u0648\u0644": "mahsool",
2957
+ "\u0645\u0627\u0644\u06CC\u062A": "maliyat",
2958
+ "\u06A9\u062A\u0627\u0628\u062A": "kitabat",
2959
+ "\u0645\u0646\u0688\u06CC": "mandi",
2960
+ "\u0646\u06CC\u0644\u0627\u0645\u06CC": "neelami",
2961
+ "\u0628\u0648\u0644\u06CC": "boli",
2962
+ "\u0634\u0631\u0627\u06A9\u062A": "sharakat",
2963
+ "\u062D\u0635\u0635": "hisas",
2964
+ "\u0627\u0633\u0679\u0627\u06A9": "stock",
2965
+ "\u062F\u0648\u0644\u062A": "daulat",
2966
+ "\u062B\u0631\u0648\u062A": "sarwat",
2967
+ "\u063A\u0631\u0628\u062A": "ghurbat",
2968
+ "\u0627\u0641\u0644\u0627\u0633": "iflas",
2969
+ "\u067E\u0631\u0648\u0641\u0627\u0626\u0644": "profile",
2970
+ "\u0633\u06CC\u0679\u0646\u06AF\u0632": "settings",
2971
+ "\u0646\u0648\u0679\u06CC\u0641\u06A9\u06CC\u0634\u0646": "notification",
2972
+ "\u0633\u0627\u0626\u0679": "site",
2973
+ "\u067E\u0648\u0631\u0679\u0644": "portal",
2974
+ // ---- administration, law, governance and politics ----
2975
+ "\u0639\u062F\u0644\u06CC\u06C1": "adliya",
2976
+ "\u0645\u0642\u0646\u0646\u06C1": "muqannana",
2977
+ "\u0627\u0646\u062A\u0638\u0627\u0645\u06CC\u06C1": "intizamia",
2978
+ "\u062D\u06A9\u0645\u0631\u0627\u0646\u06CC": "hukmrani",
2979
+ "\u062C\u0645\u06C1\u0648\u0631\u06CC\u06C1": "jamhooria",
2980
+ "\u0635\u062F\u0627\u0631\u062A": "sadarat",
2981
+ "\u0648\u0632\u0627\u0631\u062A": "wazarat",
2982
+ "\u0633\u0641\u0627\u0631\u062A": "safarat",
2983
+ "\u0642\u0648\u0646\u0635\u0644": "consul",
2984
+ "\u0633\u0641\u0627\u0631\u062A\u062E\u0627\u0646\u06C1": "safaratkhana",
2985
+ "\u0622\u0626\u06CC\u0646\u06CC": "aaeeni",
2986
+ "\u062F\u0633\u062A\u0648\u0631\u06CC": "dastoori",
2987
+ "\u0641\u0648\u062C\u062F\u0627\u0631\u06CC": "faujdari",
2988
+ "\u062F\u06CC\u0648\u0627\u0646\u06CC": "deewani",
2989
+ "\u0645\u0642\u062F\u0645\u06C1": "muqaddama",
2990
+ "\u0633\u0645\u0627\u0639\u062A": "samaat",
2991
+ "\u062F\u0631\u062E\u0648\u0627\u0633\u062A": "darkhwast",
2992
+ "\u0627\u067E\u06CC\u0644": "appeal",
2993
+ "\u0636\u0645\u0627\u0646\u062A": "zamanat",
2994
+ "\u0628\u0631\u06CC\u062A": "bariyat",
2995
+ "\u0639\u0645\u0631\u0642\u06CC\u062F": "umrqaid",
2996
+ "\u067E\u06BE\u0627\u0646\u0633\u06CC": "phansi",
2997
+ "\u0648\u06A9\u0627\u0644\u062A": "wukalat",
2998
+ "\u062D\u0642\u0648\u0642": "huqooq",
2999
+ "\u0641\u0631\u0627\u0626\u0636": "faraiz",
3000
+ "\u0634\u06C1\u0631\u06CC": "shahri",
3001
+ "\u0634\u06C1\u0631\u06CC\u062A": "shahriyat",
3002
+ "\u0634\u0646\u0627\u062E\u062A": "shanakht",
3003
+ "\u0646\u0627\u062F\u0631\u0627": "nadra",
3004
+ "\u0645\u062C\u0644\u0633": "majlis",
3005
+ "\u0634\u0648\u0631\u06CC": "shoora",
3006
+ "\u062D\u0644\u06CC\u0641": "haleef",
3007
+ "\u0645\u062E\u0627\u0644\u0641": "mukhalif",
3008
+ "\u0628\u063A\u0627\u0648\u062A": "baghawat",
3009
+ // ---- geography, nature and terrain ----
3010
+ "\u062E\u0637\u06C1": "khitta",
3011
+ "\u0635\u0648\u0628\u06C1": "sooba",
3012
+ "\u0636\u0644\u0639": "zila",
3013
+ "\u062A\u062D\u0635\u06CC\u0644": "tehsil",
3014
+ "\u06CC\u0648\u0646\u06CC\u0646": "union",
3015
+ "\u06A9\u0648\u0646\u0633\u0644": "council",
3016
+ "\u0642\u0631\u06CC\u06C1": "qarya",
3017
+ "\u0628\u0633\u062A\u06CC": "basti",
3018
+ "\u0634\u06C1\u0631\u0633\u062A\u0627\u0646": "shehristan",
3019
+ "\u0646\u062E\u0644\u0633\u062A\u0627\u0646": "nakhalistan",
3020
+ "\u06A9\u0648\u06C1\u0633\u0627\u0631": "kohsar",
3021
+ "\u06A9\u06C1\u0633\u0627\u0631": "kuhsar",
3022
+ "\u06AF\u06BE\u0627\u0679\u06CC": "ghati",
3023
+ "\u0648\u0627\u062F\u06CC\u0627\u06BA": "wadiyan",
3024
+ "\u06A9\u06BE\u0627\u0626\u06CC": "khaai",
3025
+ "\u062E\u0644\u06CC\u062C": "khaleej",
3026
+ "\u0631\u0627\u0633": "raas",
3027
+ // ---- verbs and verbal inflections ----
3028
+ "\u0645\u0627\u0646\u062A\u06D2": "mante",
3029
+ "\u0645\u0627\u0646\u062A\u06CC": "manti",
3030
+ "\u0645\u0627\u0646\u0648": "mano",
3031
+ "\u0679\u06BE\u06C1\u0631\u0646\u0627": "theharna",
3032
+ "\u0679\u06BE\u06C1\u0631\u0627": "thehra",
3033
+ "\u0679\u06BE\u06C1\u0631\u0648": "thehro",
3034
+ "\u0679\u06BE\u06C1\u0631\u062A\u06D2": "thehrte",
3035
+ "\u0633\u0645\u062C\u06BE\u0627\u0624": "samjhao",
3036
+ "\u067E\u06C1\u0646\u0686\u0627\u0624": "pohonchao",
3037
+ "\u0644\u0679\u0627\u0646\u0627": "lutana",
3038
+ "\u0644\u0679\u0627\u06CC\u0627": "lutaya",
3039
+ "\u0644\u0648\u0679\u0627": "loota",
3040
+ "\u067E\u06A9\u0627\u0631\u0627": "pukara",
3041
+ "\u067E\u06A9\u0627\u0631\u0648": "pukaro",
3042
+ "\u062C\u06BE\u06A9\u0646\u0627": "jhukna",
3043
+ "\u062C\u06BE\u06A9\u0627": "jhuka",
3044
+ "\u062C\u06BE\u06A9\u0627\u0624": "jhukao",
3045
+ "\u062C\u06BE\u06A9\u0627\u0646\u0627": "jhukana",
3046
+ "\u062A\u06BE\u0627\u0645\u0646\u0627": "thamna",
3047
+ "\u062A\u06BE\u0627\u0645\u0627": "thama",
3048
+ "\u062A\u06BE\u0627\u0645\u0648": "thamo",
3049
+ "\u0633\u0646\u0648\u0627\u0631\u0646\u0627": "sanwarna",
3050
+ "\u0633\u0646\u0648\u0627\u0631\u0627": "sanwara",
3051
+ "\u0646\u06A9\u06BE\u0627\u0631\u0646\u0627": "nikharna",
3052
+ "\u0646\u06A9\u06BE\u0627\u0631\u0627": "nikhara",
3053
+ "\u0633\u0646\u0628\u06BE\u0627\u0644\u0646\u0627": "sambhalna",
3054
+ "\u0633\u0646\u0628\u06BE\u0627\u0644\u0627": "sambhala",
3055
+ "\u0633\u0646\u0628\u06BE\u0627\u0644\u0648": "sambhalo",
3056
+ "\u067E\u0686\u06BE\u062A\u0627\u0646\u0627": "pachtana",
3057
+ "\u067E\u0686\u06BE\u062A\u0627\u06CC\u0627": "pachtaya",
3058
+ "\u06AF\u06BE\u0628\u0631\u0627\u0646\u0627": "ghabrana",
3059
+ "\u06AF\u06BE\u0628\u0631\u0627\u06CC\u0627": "ghabraya",
3060
+ "\u0645\u0633\u06A9\u0631\u0627\u0646\u0627": "muskurana",
3061
+ "\u0645\u0633\u06A9\u0631\u0627\u06CC\u0627": "muskuraya",
3062
+ "\u0645\u0633\u06A9\u0631\u0627\u06C1\u0679": "muskurahat",
3063
+ "\u062C\u06BE\u0646\u062C\u06BE\u0644\u0627\u0646\u0627": "jhanjhlana",
3064
+ "\u062A\u0644\u0645\u0644\u0627\u0646\u0627": "tilmilana",
3065
+ "\u0628\u0644\u0628\u0644\u0627\u0646\u0627": "bilbilana",
3066
+ "\u06A9\u06BE\u0644\u06A9\u06BE\u0644\u0627\u0646\u0627": "khilkhilana",
3067
+ "\u06A9\u06BE\u0679\u06A9\u06BE\u0679\u0627\u0646\u0627": "khatkhatana",
3068
+ "\u062C\u06BE\u0644\u0645\u0644\u0627\u0646\u0627": "jhilmilana",
3069
+ "\u0686\u0645\u0686\u0645\u0627\u062A\u0627": "chamchamata",
3070
+ "\u0644\u06C1\u0631\u0627\u0646\u0627": "lehrana",
3071
+ "\u0644\u06C1\u0631\u0627\u06CC\u0627": "lehraya",
3072
+ "\u0644\u06C1\u0631": "lehar"
2889
3073
  };
2890
3074
  var ROMAN_VARIANTS = {
2891
3075
  hay: "\u06C1\u06D2",
@@ -3073,7 +3257,35 @@ var ROMAN_VARIANTS = {
3073
3257
  daur: "\u062F\u0648\u0631",
3074
3258
  kurta: "\u06A9\u0631\u062A\u0627",
3075
3259
  haseen: "\u062D\u0633\u06CC\u0646",
3076
- malik: "\u0645\u0644\u06A9"
3260
+ malik: "\u0645\u0644\u06A9",
3261
+ kidhr: "\u06A9\u062F\u06BE\u0631",
3262
+ idhr: "\u0627\u062F\u06BE\u0631",
3263
+ jdhr: "\u062C\u062F\u06BE\u0631",
3264
+ thek: "\u0679\u06BE\u06CC\u06A9",
3265
+ thk: "\u0679\u06BE\u06CC\u06A9",
3266
+ sahi: "\u0635\u062D\u06CC\u062D",
3267
+ galat: "\u063A\u0644\u0637",
3268
+ ghalat: "\u063A\u0644\u0637",
3269
+ sb: "\u0633\u0628",
3270
+ hmsha: "\u06C1\u0645\u06CC\u0634\u06C1",
3271
+ kbhi: "\u06A9\u0628\u06BE\u06CC",
3272
+ aksar: "\u0627\u06A9\u062B\u0631",
3273
+ behtareen: "\u0628\u06C1\u062A\u0631\u06CC\u0646",
3274
+ zabardast: "\u0632\u0628\u0631\u062F\u0633\u062A",
3275
+ shandar: "\u0634\u0627\u0646\u062F\u0627\u0631",
3276
+ khoob: "\u062E\u0648\u0628",
3277
+ khub: "\u062E\u0648\u0628",
3278
+ sharam: "\u0634\u0631\u0645",
3279
+ haya: "\u062D\u06CC\u0627",
3280
+ ghairat: "\u063A\u06CC\u0631\u062A",
3281
+ himmat: "\u06C1\u0645\u062A",
3282
+ hosla: "\u062D\u0648\u0635\u0644\u06C1",
3283
+ mashaallah: "\u0645\u0627\u0634\u0627\u0621\u0627\u0644\u0644\u06C1",
3284
+ inshaallah: "\u0627\u0646\u0634\u0627\u0621\u0627\u0644\u0644\u06C1",
3285
+ mashallah: "\u0645\u0627\u0634\u0627\u0621\u0627\u0644\u0644\u06C1",
3286
+ inshallah: "\u0627\u0646\u0634\u0627\u0621\u0627\u0644\u0644\u06C1",
3287
+ alhamdulillah: "\u0627\u0644\u062D\u0645\u062F\u0644\u0644\u06C1",
3288
+ jazakallah: "\u062C\u0632\u0627\u06A9\u200C\u0627\u0644\u0644\u06C1"
3077
3289
  };
3078
3290
 
3079
3291
  // src/transliterate.ts