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 🙏

© 2024 – Pkg Stats / Ryan Hefner

lotin-kirill

v0.1.5

Published

Transform Uzbek latin characters into Uzbek-cyrillic characters or vice versa. O'zbekcha so'zlarni lotin alifbosidan kirill alifbosiga (yoki aksincha) o'girish.

Downloads

23

Readme

Lotin-Kirill

Transliterator for Uzbek words with high accuracy (from latin alphabet to cyrillic and vice versa). Used at transliterator.uz

O‘zbek tilida o‘qish

Installation

NPM

npm install lotin-kirill --save

Yarn

yarn add lotin-kirill

UNPKG

<script src="https://unpkg.com/lotin-kirill/dist-umd/index.min.js"></script>

Usage

Initialize the engine:

import Transliterator from 'lotin-kirill';

const transliterator = new Transliterator();

When using UNPKG distribution:

<script src="https://unpkg.com/lotin-kirill/dist-umd/index.min.js"></script>
<script>
  const Transliterator = lotinKirill.default;
  const transliterator = new Transliterator();
</script>

Single word transliteration:

toLatin(word: string): string

toCyrillic(word: string): string

Example

const latinWord = transliterator.toLatin('мотивация');
console.log(latinWord); // -> 'motivatsiya'

const cyrillicWord = transliterator.toCyrillic("e'lon");
console.log(cyrillicWord); // -> 'эълон'

Text (multiple words) transliteration:

textToLatin(text: string): string

textToCyrillic(text: string): string

Example

const latinText = transliterator.textToLatin('Жуда узун кириллча текст.');
console.log(latinText); // -> 'Juda uzun kirillcha tekst.'

const cyrillicText = transliterator.textToCyrillic('Juda uzun lotincha tekst.');
console.log(cyrillicText); // -> 'Жуда узун лотинча текст.'

Exceptional words

You can initialize the transliterator object with an exceptional words list:

import Transliterator from 'lotin-kirill';

const transliterator = new Transliterator([
  // [latinWord, cyrillicWord]
  ['oktabr', 'октябрь'],
  ['Google', 'Google'],
]);

const cyrillicWord = transliterator.toCyrillic('oktabr');
console.log(cyrillicWord); // -> 'октябрь' (not 'октабр')

One exceptional pair is enough for both cyrilllic and latin transliterations.

// This also works
const latinWord = transliterator.toLatin('октябрь');
console.log(latinWord); // -> 'oktabr' (not 'oktyabr')

If exceptional pair is a pair of same words, the word is not transliterated.

const cyrillicWord = transliterator.toCyrillic('Google');
console.log(cyrillicWord); // -> 'Google'

Exceptional words with sufixes are also detected.

Variants of a word with prefixes should be added as separate exceptionals!

// This also works
const latinWord = transliterator.toLatin('октябрда');
console.log(latinWord); // -> 'oktabrda' (not 'oktyabrda')

You can extend the exceptionals list after the initialization of the transliterator.

transliterator.extendExceptionals([['nol', 'ноль']]);

Or purge all of the exceptionals added to transliterator.

transliterator.purgeExceptionals();

Pure transliterator functions

There are pure transliterator functions which operate only on basic transliteration rules. These functions don't look up words in exceptionals list.

cyrillicToLatin(word: string): string

latinToCyrillic(word: string): string

import Transliterator, { cyrillicToLatin, latinToCyrillic } from 'lotin-kirill';

const transliterator = new Transliterator([['oktabr', 'октябрь']]);

console.log(transliterator.toLatin('октябрь')); // -> 'oktabr'
console.log(cyrillicToLatin('октябрь')); // -> 'oktyabr'

console.log(transliterator.toCyrillic('oktabr')); // -> 'октябрь'
console.log(latinToCyrillic('oktabr')); // -> 'октабр'