@shabados/gurmukhi-utils v1.2.0
@shabados/gurmukhi-utils
General utilities for working with Gurmukhi.
Usage
const { toUnicode, toAscii, firstLetters } = require('gurmukhi-utils')
toUnicode('Koj') // Returns ਖੋਜ
toAscii('ਖੋਜ') // Returns Koj
firstLetters('hir hir hir gunI') // Returns hhhg
firstLetters('ਹਰਿ ਹਰਿ ਹਰਿ ਗੁਨੀ') // Returns ਹਹਹਗ
Docs
Functions
firstLetters(line, stripNukta) ⇒ String
Generates the first letters for a given ASCII or unicode Gurmukhi string. By default, the function will transform letters with bindi to their simple equivalent, for example, zaza to jaja (ਜ਼ => ਜ).
Kind: global function
Returns: String - The first letters of each word in the provided Gurmukhi line.
Param | Type | Default | Description |
---|---|---|---|
line | String | The line to generate the first letters for. | |
stripNukta | Boolean | true | If true , replaces letters pair bindi (such as ਜ਼) with their equivalent without the bindi (ਜ). Also replaces open oora with closed oora. |
Example (Unicode first letters no pair bindi/nukta)
firstLetters('ਗ਼ੈਰਿ ਹਮਦਿ ਹੱਕ ਨਿਆਇਦ ਬਰ ਜ਼ਬਾਨਮ ਹੀਚ ਗਾਹ') // => ਗਹਹਨਬਜਹਗ
Example (Unicode first letters with pair bindi/nukta)
firstLetters('ਗ਼ੈਰਿ ਹਮਦਿ ਹੱਕ ਨਿਆਇਦ ਬਰ ਜ਼ਬਾਨਮ ਹੀਚ ਗਾਹ') // => ਗ਼ਹਹਨਬਜ਼ਹਗ
Example (ASCII first letters no pair bindi/nukta)
firstLetters('ijs no ik®pw krih iqin nwmu rqnu pwieAw ]') // => jnkkqnrp
firstLetters('iZir&qym sMdUk drIXw AmIk ]') // => gsdA
Example (ASCII first letters with pair bindi/nukta)
firstLetters('iZir&qym sMdUk* drIXw AmIk* ]', false) // => Zsda
toUnicode(text) ⇒ String
Converts ASCII text used in the GurmukhiAkhar font to Unicode.
Kind: global function
Returns: String - A unicode representation of the provided ASCII Gurmukhi string.
Param | Type | Description |
---|---|---|
text | String | The ASCII text to convert. |
transliterate(line) ⇒ String
Transliterates a line from ASCII Gurmukhi to english.
Currently supports the ,
, ;
, .
vishraam characters.
Kind: global function
Returns: String - The English transliteration of the provided Gurmukhi line.
Param | Type | Description |
---|---|---|
line | String | The Gurmukhi ASCII line to transliterate. |
Example
transliterate('hukmI hukmu clwey rwhu ]') // => hukamee hukam chalaae raahu ||
Example
transliterate('BWfw Bwau AMimRqu iqqu Fwil ]') // => bhaa(n)ddaa bhaau anmrit tit ddaal ||
Future
- Unicode to ASCII