npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tifinagh-convert

v0.1.0

Published

Tifinagh ↔ Latin script converter for the Amazigh (Tamazight) language — supports informal input aliases, auto-detection, and regional variants

Readme

tifinagh-convert

Why

Amazigh (Tamazight) remains one of the most under-resourced languages in NLP and software. Developers building Tifinagh-aware tools — OCR pipelines, keyboards, dictionaries — have had to re-implement the same script conversion logic from scratch. This package is the shared infrastructure that should have existed.

Tifinagh ↔ Latin script converter for the Amazigh (Tamazight) language.

Zero dependencies. TypeScript-first. Based on the official IRCAM Neo-Tifinagh standard and the ALA-LC / BGN-PCGN romanization tables.

npm install tifinagh-convert

Quick start

import { convert, detect, alphabet } from 'tifinagh-convert'

// Tifinagh → Latin
const r1 = convert('ⵜⴰⵎⵓⵔⵜ', { to: 'latin' })
console.log(r1.output)   // 'tamurt'

// Latin → Tifinagh
const r2 = convert('tamurt', { from: 'latin', to: 'tifinagh' })
console.log(r2.output)   // 'ⵜⴰⵎⵓⵔⵜ'

// Auto-detect source script
const r3 = convert('ⵎⵓⵔ', { to: 'latin' })
console.log(r3.output)   // 'mur'

API

convert(text, options)

| Option | Type | Default | Description | |----------|--------------------------|--------------|------------------------------------| | to | 'tifinagh' \| 'latin' | required | Target script | | from | 'tifinagh' \| 'latin' | auto-detect | Source script (optional) | | region | 'morocco' \| 'algeria' | 'morocco' | Affects letter inventory |

Returns ConvertResult:

{
  output:   string              // converted text
  from:     Script
  to:       Script
  region:   Region
  detected: boolean             // true if script was auto-detected
  warnings: ConversionWarning[] // ambiguous or unknown characters
}

Each warning:

{
  code:     'AMBIGUOUS_DIGRAPH' | 'UNKNOWN_CHAR' | 'APPROXIMATED_CHAR'
  message:  string
  position: number  // zero-based index in the input string
}

detect(text)

Auto-detects which script a string is written in.

detect('ⵜⴰⵎⵓⵔⵜ') // { script: 'tifinagh', confidence: 1 }
detect('tamurt')   // { script: 'latin',    confidence: 1 }
detect('مراكش')    // { script: 'arabic',   confidence: 1 }

alphabet(options?)

Returns the Amazigh alphabet as a structured list.

alphabet()                      // all letters (Morocco standard)
alphabet({ type: 'vowel' })     // only the 4 vowels: ⴰ ⴻ ⵉ ⵓ
alphabet({ region: 'algeria' }) // includes Algeria-only letters

Each entry:

{
  tifinagh: string
  unicode:  string
  latin:    string
  type:     'vowel' | 'consonant' | 'modifier'
  region?:  'algeria'
  note?:    string
}

Input aliases (Latin → Tifinagh)

When typing Amazigh in Latin without special characters, people use informal conventions online. This package accepts all of them:

| You type | You get | Note | |----------|---------|------| | gh or v or ɣ | | voiced velar fricative | | kh or x | | voiceless velar fricative | | sh or ch or c | | | | o | | same sound as u in Amazigh | | 3 or ɛ | | ayin | | T or | | emphatic t | | H or | | emphatic h | | R or or | | emphatic r | | S or or | | emphatic s |

convert('3icha',  { from: 'latin', to: 'tifinagh' }).output  // ⵄⵉⵛⴰ
convert('lakhSas', { from: 'latin', to: 'tifinagh' }).output // ⵍⴰⵅⵚⴰⵙ
convert('tachelHit', { from: 'latin', to: 'tifinagh' }).output // ⵜⴰⵛⴻⵍⵃⵉⵜ

The output direction (Tifinagh → Latin) always uses the standard romanization — ɣ for ⵖ, not gh or v.


Digraph disambiguation (Latin → Tifinagh)

gh is an alias for . If you ever need to write a literal g followed by h as two separate letters, use a middle dot (U+00B7):

convert('agham',  { from: 'latin', to: 'tifinagh' }) // ⴰⵖⴰⵎ
convert('ag·ham', { from: 'latin', to: 'tifinagh' }) // ⴰⴳⵀⴰⵎ  (g then h)

Labialized consonants

Some Tifinagh consonants are written as two Unicode codepoints (base letter + tamatart U+2D6F) but represent one sound. The converter handles them automatically:

convert('\u2D3D\u2D6F', { from: 'tifinagh', to: 'latin' }) // 'kʷ'

Regional variants

Algeria uses one letter not in the Moroccan IRCAM standard (U+2D35 / ǧ). Pass region: 'algeria' to enable it:

convert('\u2D35am', { from: 'tifinagh', to: 'latin', region: 'algeria' }) // 'ǧam'

Data sources


Roadmap

  • [x] Tifinagh → Latin
  • [x] Latin → Tifinagh
  • [x] Auto-detect script
  • [x] Morocco / Algeria regional variants
  • [x] Informal input aliases (gh, kh, sh, 3, v, c…)
  • [ ] Arabic script support (v0.2)
  • [ ] Gemination rules
  • [ ] Tuareg / historical Tifinagh variants

Contributing

Corrections to the mapping table, dialect coverage, or documentation are welcome. Open an issue or pull request at: https://github.com/hamza-bouqssim/tifinagh-convert


License

MIT © Hamza BOUQSSIM