summaryrefslogtreecommitdiff
path: root/zh-ko-or-ja
diff options
context:
space:
mode:
authorPatrick Simianer <pks@pks.rocks>2020-08-12 07:32:06 +0200
committerPatrick Simianer <pks@pks.rocks>2020-08-12 07:32:06 +0200
commit64e8bdba930479249b8dfbc4b5d4b659a95433f0 (patch)
treee26969b03d8380ee8d2cbc1328f851772006133c /zh-ko-or-ja
parent74e20e00dfbffdcf117778049e47acd79e320110 (diff)
parent4732fb3be94ba3f88b18295cf1c00e8c616eec73 (diff)
Merge branch 'master' of ssh://github.com/pks/nlp_scripts
Diffstat (limited to 'zh-ko-or-ja')
-rwxr-xr-xzh-ko-or-ja18
1 files changed, 18 insertions, 0 deletions
diff --git a/zh-ko-or-ja b/zh-ko-or-ja
new file mode 100755
index 0000000..0b42386
--- /dev/null
+++ b/zh-ko-or-ja
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+require 'zipf'
+require 'script_detector'
+
+$to_code = {}
+$to_code["Ambiguous Chinese"] = "??"
+$to_code["Simplified Chinese"] = "zh"
+$to_code["Traditional Chinese"] = "zt"
+$to_code["Korean"] = "ko"
+$to_code["Japanese"] = "ja"
+$to_code.default = "??"
+
+while line = STDIN.gets
+ code = $to_code[line.identify_script]
+ puts code
+end
+