Skip to content

Instantly share code, notes, and snippets.

@maxp
Created March 3, 2022 13:08
Show Gist options
  • Save maxp/eff5f1dc82e79daa32a777d680266d84 to your computer and use it in GitHub Desktop.
Save maxp/eff5f1dc82e79daa32a777d680266d84 to your computer and use it in GitHub Desktop.
(def translit-table-ru-en
(apply array-map [\a "a"
\b "b"
\c "c"
\d "d"
\e "e"
\f "f"
\g "g"
\h "h"
\i "i"
\j "j"
\k "k"
\l "l"
\m "m"
\n "n"
\o "o"
\p "p"
\q "q"
\r "r"
\s "s"
\t "t"
\u "u"
\v "v"
\w "w"
\x "x"
\y "y"
\z "z"
\1 "1"
\2 "2"
\3 "3"
\4 "4"
\5 "5"
\6 "6"
\7 "7"
\8 "8"
\9 "9"
\0 "0"
"a"
"b"
"v"
"g"
"d"
"e"
"e"
"zh"
"z"
"i"
"j"
"k"
"l"
"m"
"n"
"o"
\п "p"
"r"
"s"
"t"
"u"
"f"
"kh"
"c"
"ch"
"sh"
"shh"
""
"y"
""
"e"
"yu"
"ya"
\space "-"
]))
(defn make-translit [table s]
(reduce #(str % (or (table %2) "")) "" (clojure.string/lower-case s)))
(defn make-translit-ru-en [s]
(make-translit translit-table-ru-en s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment