pashto-phonetics-translator

A JavaScript library that translates Open Pashto phonetics into other forms of Pashto transliteration.


Keywords
pashto, phonetics, transliteration, romanization
License
MIT
Install
npm install pashto-phonetics-translator@0.1.1

Documentation

pashto-phonetics-translator

NPM

Build Status Made with Typescript

A JavaScript library that translates Open Pashto phonetics into other forms of Pashto transliteration.

Usage

npm install --save pashto-phonetics-translator
const { 
    translatePhonetics,
    convertAfToPkSpelling,
} = require("pashto-phonetics-translator");

const translatedPhonetics = translatePhonetics("puxto", {
    system: "ipa",
    dialect: "southern",
});
console.log(translatedPhonetics);
// output: pəʂt̪o

const translatedScript = convertAfToPkSpelling("سړی");
console.log(translatedScript);
// output: سړے

API

translatePhonetics(input, [options])

Translates given phonetics (Latin transliteration) from the Open Pashto phonetics system into other phonetics systems.

options

options.system
  • "ipa"
  • "alalc"
options.dialect
  • "standard"
  • "peshawer"
  • "southern"

convertAfToPkSpelling(input: string): string

Converts Pashto text written in Afghan spelling into Pakistani spelling

Note: This is quite beta, experimental and is only recommended for small, controlled pieces of text.

Known Issue: Arabic load words ending with ی as a long a sound will get incorrectly converted to endings with ے. To avoid this be sure to write such word with the superscript Alef diacritic. eg: حتیٰ, معنیٰ, موسیٰ, etc.

convertPkToAfSpelling(input: string): string

Converts Pashto text written in Pakistani spelling into Afghan spelling

Note: This is quite beta, experimental and is only recommended for small, controlled pieces of text.

Known Issue: Arabic load words ending with ی as a long a sound will get incorrectly converted to endings with ي. To avoid this be sure to write such word with the superscript alef diacritic. eg: حتیٰ, معنیٰ, موسیٰ, etc.

standardizePashto(input: string): string

Converts Pashto text into standard spelling as used by BBC Pashto. ك's are replaced with ک's and ي's in the middle of the word are replaced with ی's, etc.