-
Notifications
You must be signed in to change notification settings - Fork 1
/
gost_52535.cr
126 lines (116 loc) · 3.06 KB
/
gost_52535.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# DO NOT EDIT THIS FILE.
# Generated from Iuliia schemas. See `Iuliia::SchemaImporter`.
require "../engine"
module Iuliia
# The `Gost52535` module provides transliteration (`Engine.translate`) using
# the GOST R 52535.1-2006 transliteration schema.
#
# [More information](https://iuliia.ru/gost-52535/) (in Russian)
#
# ### Examples
#
# ```
# Iuliia::Gost52535.translate("Юлия Щеглова")
# # => "Iuliia Shcheglova"
#
# Iuliia::Gost52535.translate("Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю")
# # => "Iuliia, sesh eshche etikh miagkikh frantcuzskikh bulok iz Ioshkar-Oly, da vypei altaiskogo chaiu"
# ```
module Gost52535
include Iuliia::Engine
extend self
private NAME = "gost_52535"
private DESCRIPTION = "GOST R 52535.1-2006 transliteration schema"
private STANDARD_RULES_MAPPING = {
"а" => "a",
"б" => "b",
"в" => "v",
"г" => "g",
"д" => "d",
"е" => "e",
"ё" => "e",
"ж" => "zh",
"з" => "z",
"и" => "i",
"й" => "i",
"к" => "k",
"л" => "l",
"м" => "m",
"н" => "n",
"о" => "o",
"п" => "p",
"р" => "r",
"с" => "s",
"т" => "t",
"у" => "u",
"ф" => "f",
"х" => "kh",
"ц" => "tc",
"ч" => "ch",
"ш" => "sh",
"щ" => "shch",
"ъ" => "",
"ы" => "y",
"ь" => "",
"э" => "e",
"ю" => "iu",
"я" => "ia",
"А" => "A",
"Б" => "B",
"В" => "V",
"Г" => "G",
"Д" => "D",
"Е" => "E",
"Ё" => "E",
"Ж" => "Zh",
"З" => "Z",
"И" => "I",
"Й" => "I",
"К" => "K",
"Л" => "L",
"М" => "M",
"Н" => "N",
"О" => "O",
"П" => "P",
"Р" => "R",
"С" => "S",
"Т" => "T",
"У" => "U",
"Ф" => "F",
"Х" => "Kh",
"Ц" => "Tc",
"Ч" => "Ch",
"Ш" => "Sh",
"Щ" => "Shch",
"Ъ" => "",
"Ы" => "Y",
"Ь" => "",
"Э" => "E",
"Ю" => "Iu",
"Я" => "Ia",
}
private PREVIOUS_CHARACTERS_RULES_MAPPING = {} of String => String
private NEXT_CHARACTERS_RULES_MAPPING = {} of String => String
private SPECIAL_WORD_ENDINGS_RULES_MAPPING = {} of String => String
# Returns the transliteration schema **name**.
def name : String
NAME
end
# Returns the transliteration schema **description**.
def description : String
DESCRIPTION
end
private def standard_rules_mapping : Hash(String, String)
STANDARD_RULES_MAPPING
end
private def previous_characters_rules_mapping : Hash(String, String)
PREVIOUS_CHARACTERS_RULES_MAPPING
end
private def next_characters_rules_mapping : Hash(String, String)
NEXT_CHARACTERS_RULES_MAPPING
end
private def special_word_endings_rules_mapping : Hash(String, String)
SPECIAL_WORD_ENDINGS_RULES_MAPPING
end
end
end