Skip to content

Instantly share code, notes, and snippets.

@mamantoha
Created April 17, 2012 19:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamantoha/2408619 to your computer and use it in GitHub Desktop.
Save mamantoha/2408619 to your computer and use it in GitHub Desktop.
# -*- encoding: utf-8 -*-
#http://en.wiktionary.org/wiki/Index:Chinese_radical
ua_cn = {
'а' => '开',
'б' => '石',
'в' => '阝',
'г' => '厂',
'ґ' => '广',
'д' => '马',
'е' => '仨',
'є' => '它',
'ж' => '米',
'з' => '彐',
'и' => '凵',
'і' => '讠',
'ї' => '讠',
'й' => '凵',
'к' => '长',
'л' => '人',
'м' => '从',
'н' => '廾',
'о' => '〇',
'п' => '丌',
'р' => '尸',
'с' => '匸',
'т' => '丅',
'у' => '丫',
'ф' => '中',
'х' => '乂',
'ц' => '刂',
'ч' => '丩',
'ш' => '山',
'щ' => '屮',
'ь' => '力',
'ю' => '扣',
'я' => '牙'
}
pattern = ua_cn.keys.join
s = ARGV[0] || "дивовижні китайські ієрогліфи :)"
puts s.gsub(/[#{pattern}]/, ua_cn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment