urdu-text-utils 0.1.1 → 0.1.3
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 +12 -0
- package/README.md +22 -1
- package/dist/index.cjs +1767 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1767 -103
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
- Significantly expand transliteration dictionary coverage across pronouns & oblique forms (`مجھے`, `ہمیں`, `انہیں`, `اسے`, `جسے`), everyday verbs and inflections, calendar & weekdays, numbers & ordinals, food, household objects, health, geography, and common Pakistani names.
|
|
6
|
+
- Expanded Roman Urdu variants (`ROMAN_VARIANTS`) for common texting and phonetically ambiguous spellings (`mjhe`, `humein`, `unhein`, `isay`, `chahye`, etc.).
|
|
7
|
+
- Enhanced dictionary normalization and clean token mapping for slug generation and reverse transliteration.
|
|
8
|
+
|
|
9
|
+
## 0.1.2
|
|
10
|
+
|
|
11
|
+
- Dictionary grows to ~650 entries: news and public-life vocabulary (the densest register in Urdu media), technology, education, health, colours, animals, extended family, food and place names.
|
|
12
|
+
- Rule fallback reads `ی` by position — `e` inside a word (`کھیل` → `khel`), `i` at the end (`پڑھی` → `parhi`) — and recognises the final `یں` plural ending (`سڑکیں` → `sarkein`, previously `sarkin`).
|
|
13
|
+
- `مارنا` transliterates as `maarna` so it no longer collapses into `مرنا` in the reverse direction.
|
|
14
|
+
|
|
3
15
|
## 0.1.1
|
|
4
16
|
|
|
5
17
|
- Expand the transliteration dictionary to ~450 entries: high-frequency vocabulary, oblique infinitives (`کرنے`, `رہنے`), English loanwords (`سکول`, `کمپیوٹر`) and common Roman spelling variants. The dictionary moved to `src/dictionary.ts`.
|
package/README.md
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
# urdu-text-utils
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/urdu-text-utils)
|
|
4
|
+
[](https://github.com/Zaid-maker/urdu-text-utils/actions/workflows/ci.yml)
|
|
5
|
+
[](https://bundlejs.com/?q=urdu-text-utils)
|
|
6
|
+
[](https://www.npmjs.com/package/urdu-text-utils?activeTab=dependencies)
|
|
7
|
+
[](https://www.npmjs.com/package/urdu-text-utils)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
|
|
3
10
|
Urdu text processing toolkit for JavaScript and TypeScript. Normalization, detection, digits, diacritics, collation, search, statistics and transliteration.
|
|
4
11
|
|
|
5
12
|
Zero runtime dependencies. ESM + CJS. Ships its own types.
|
|
6
13
|
|
|
14
|
+
**[Documentation and live playground →](https://zaid-maker.github.io/urdu-text-utils/)**
|
|
15
|
+
|
|
7
16
|
```bash
|
|
8
17
|
npm install urdu-text-utils
|
|
9
18
|
```
|
|
@@ -155,7 +164,7 @@ Read this before putting it in front of users.
|
|
|
155
164
|
|
|
156
165
|
Urdu script omits short vowels, so the mapping is genuinely ambiguous: `کتب` is `kitab` or `kutub` depending on context and no rule table can decide which. The reverse direction is worse, because Roman Urdu has no standard orthography (`hai` / `hay` / `he` all occur).
|
|
157
166
|
|
|
158
|
-
These functions work in two layers: a dictionary of ~
|
|
167
|
+
These functions work in two layers: a dictionary of ~650 high-frequency words, English loanwords and oblique verb forms, then a rule fallback that handles aspirated digraphs, word-initial `و`/`ی` as consonants, word-final `ہ` as `-a`, `ی` by position (`کھیل` → `khel`, `پڑھی` → `parhi`, `سڑکیں` → `sarkein`), and a schwa insertion so unseen words stay pronounceable. Dictionary hits are reliable; rule output is an approximation. Do not build anything irreversible on it. A real lexicon plus a statistical model is planned, not faked here.
|
|
159
168
|
|
|
160
169
|
```ts
|
|
161
170
|
romanize("آپ کیسے ہیں"); // "aap kaisay hain"
|
|
@@ -182,6 +191,18 @@ npm run typecheck
|
|
|
182
191
|
npm run build
|
|
183
192
|
```
|
|
184
193
|
|
|
194
|
+
### Docs site
|
|
195
|
+
|
|
196
|
+
The site is VitePress, in `docs/`. Its playground imports the library from `src/` through a Vite alias, so the examples can never drift from the code.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npm run docs:dev # local server with hot reload
|
|
200
|
+
npm run docs:build # static output in docs/.vitepress/dist
|
|
201
|
+
npm run docs:preview
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
CI builds the docs on every push. VitePress fails on dead links, so a renamed page breaks the build rather than shipping a 404.
|
|
205
|
+
|
|
185
206
|
## Releasing
|
|
186
207
|
|
|
187
208
|
Publishing is automated and tag-driven. CI runs tests on Node 18/20/22 for every push and PR; nothing reaches npm until a version tag exists.
|