Class: Babosa::Transliterator::Cyrillic

Inherits:
Base
  • Object
show all
Defined in:
lib/babosa/transliterator/cyrillic.rb

Overview

Approximations are based on GOST 7.79, System B: en.wikipedia.org/wiki/ISO_9#GOST_7.79

Direct Known Subclasses

Bulgarian, Macedonian, Russian, Ukrainian

Constant Summary collapse

APPROXIMATIONS =
{
  "Ё" => "Yo",
  "Ѓ" => "G",
  "Є" => "Ye",
  "Ї" => "Yi",
  "Љ" => "L",
  "Њ" => "N",
  "Ќ" => "K",
  "Ў" => "U",
  "Џ" => "Dh",
  "А" => "A",
  "Б" => "B",
  "В" => "V",
  "Г" => "G",
  "Д" => "D",
  "Е" => "E",
  "Ж" => "Zh",
  "З" => "Z",
  "И" => "I",
  "Й" => "J",
  "К" => "K",
  "Л" => "L",
  "М" => "M",
  "Н" => "N",
  "О" => "O",
  "П" => "P",
  "Р" => "R",
  "С" => "S",
  "Т" => "T",
  "У" => "U",
  "Ф" => "F",
  "Х" => "X",
  "Ц" => "Cz",
  "Ч" => "Ch",
  "Ш" => "Sh",
  "Щ" => "Shh",
  "Ъ" => "",
  "Ы" => "Y",
  "Ь" => "",
  "Э" => "E",
  "Ю" => "Yu",
  "Я" => "Ya",
  "а" => "a",
  "б" => "b",
  "в" => "v",
  "г" => "g",
  "д" => "d",
  "е" => "e",
  "ж" => "zh",
  "з" => "z",
  "и" => "i",
  "й" => "j",
  "к" => "k",
  "л" => "l",
  "м" => "m",
  "н" => "n",
  "о" => "o",
  "п" => "p",
  "р" => "r",
  "с" => "s",
  "т" => "t",
  "у" => "u",
  "ф" => "f",
  "х" => "x",
  "ц" => "cz",
  "ч" => "ch",
  "ш" => "sh",
  "щ" => "shh",
  "ъ" => "",
  "ы" => "y",
  "ь" => "",
  "э" => "e",
  "ю" => "yu",
  "я" => "ya",
  "ё" => "yo",
  "ѓ" => "g",
  "є" => "ye",
  "ї" => "yi",
  "љ" => "l",
  "њ" => "n",
  "ќ" => "k",
  "ў" => "u",
  "џ" => "dh",
  "Ѣ" => "Ye",
  "ѣ" => "ye",
  "Ѫ" => "O",
  "ѫ" => "o",
  "Ѳ" => "Fh",
  "ѳ" => "fh",
  "Ѵ" => "Yh",
  "ѵ" => "yh",
  "Ґ" => "G",
  "ґ" => "g"
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#approximations

Instance Method Summary collapse

Methods inherited from Base

#[], #initialize

Constructor Details

This class inherits a constructor from Babosa::Transliterator::Base

Instance Method Details

#transliterate(string) ⇒ Object



103
104
105
# File 'lib/babosa/transliterator/cyrillic.rb', line 103

def transliterate(string)
  super.gsub(/(c)z([ieyj])/) { "#{Regexp.last_match(1)}#{Regexp.last_match(2)}" }
end