Coder Social home page Coder Social logo

ian-nai / domovyk Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 219 KB

A Python package to transliterate various Cyrillic alphabets to and from the Latin alphabet using the American Library Association-Library of Congress Romanization tables.

License: GNU General Public License v3.0

Python 100.00%

domovyk's Introduction

Domovyk

A Python package to transliterate various Cyrillic alphabets to and from the Latin alphabet using the American Library Association-Library of Congress Romanization tables.

domovyk statue

Domovyk is named after household spirits from Slavic mythology.

Installation

Install using pip:

pip3 install domovyk

Or download the GitHub repo and the install the only dependency (for sentence tokenization):

pip3 install nltk

Usage

The package uses the ALA-LC Romanization tables to transliterate each of the following languages:

  • Belarusian
  • Bulgarian
  • Carpatho-Rusyn
  • Church Slavonic
  • Macedonian
  • Russian
  • Serbian
  • Ukrainian

Four functions can be called for each language:

  • transliterate(var, lang) - Transliterates a Cyrillic string or list of strings (var) from a specified language (lang) into the Latin alphabet. Returns a string.
  • translatinate(var, lang) - Transliterates a string or list of strings in the Latin alphabet (var) to a specified Cyrillic script (lang). Returns a string.
  • transliterateSents(var, lang) - Tokenizes a given Cyrillic (var) into a list of sentences, then transliterates those sentences from a specified language (lang) into the Latin alphabet. Returns a list.
  • translatinateSents(var, lang) - Tokenizes a given string in the Latin alphabet (var) into a list of sentences, then transliterates those sentences to a specified Cyrillic script (lang). Returns a list.

Some usage examples are below:

from domovyk import translit

belarusian_to_latin = translit.transliterate('Як справы?', 'bel')
latin_to_macedonian = translit.translatinate('Hi, how are you?', 'mac')
ukrainian_to_latin_sents = translit.transliterateSents('Єхидна, ґава, їжак ще й шиплячі плазуни бігцем форсують Янцзи.', 'ukr')
latin_to_russian_sents = translit.translatinateSents('Hello, how are you doing?', 'rus')

The languages can be called in the code using the following abbreviations:

  • Belarusian - 'bel'
  • Bulgarian - 'bulg'
  • Carpatho-Rusyn - 'carp'
  • Church Slavonic - 'church'
  • Macedonian - 'mac'
  • Russian 'rus'
  • Serbian - 'serb'
  • Ukrainian - 'ukr'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.