babylon 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/babylon.rb +95 -3
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/babylon.rb
CHANGED
@@ -7,10 +7,102 @@ module Babylon
|
|
7
7
|
|
8
8
|
class UncertaintyError < StandardError; end;
|
9
9
|
|
10
|
-
VERSION = '0.1.
|
11
|
-
|
10
|
+
VERSION = '0.1.1'
|
11
|
+
|
12
12
|
SERVICE_URL = 'http://www.google.com/uds/GlangDetect'
|
13
13
|
format :json
|
14
|
+
|
15
|
+
LANGUAGES = {
|
16
|
+
'af' => :afrikaans,
|
17
|
+
'sq' => :albanian,
|
18
|
+
'am' => :amharic,
|
19
|
+
'ar' => :arabic,
|
20
|
+
'hy' => :armenian,
|
21
|
+
'az' => :azerbaijani,
|
22
|
+
'eu' => :basque,
|
23
|
+
'be' => :belarusian,
|
24
|
+
'bn' => :bengali,
|
25
|
+
'bh' => :bihari,
|
26
|
+
'bg' => :bulgarian,
|
27
|
+
'my' => :burmese,
|
28
|
+
'ca' => :catalan,
|
29
|
+
'chr' => :cherokee,
|
30
|
+
'zh' => :chinese,
|
31
|
+
'zh-CN' => :chinese_simplified,
|
32
|
+
'zh-TW' => :chinese_traditional,
|
33
|
+
'hr' => :croatian,
|
34
|
+
'cs' => :czech,
|
35
|
+
'da' => :danish,
|
36
|
+
'dv' => :dhivehi,
|
37
|
+
'nl' => :dutch,
|
38
|
+
'en' => :english,
|
39
|
+
'eo' => :esperanto,
|
40
|
+
'et' => :estonian,
|
41
|
+
'tl' => :filipino,
|
42
|
+
'fi' => :finnish,
|
43
|
+
'fr' => :french,
|
44
|
+
'gl' => :galician,
|
45
|
+
'ka' => :georgian,
|
46
|
+
'de' => :german,
|
47
|
+
'el' => :greek,
|
48
|
+
'gn' => :guarani,
|
49
|
+
'gu' => :gujarati,
|
50
|
+
'iw' => :hebrew,
|
51
|
+
'hi' => :hindi,
|
52
|
+
'hu' => :hungarian,
|
53
|
+
'is' => :icelandic,
|
54
|
+
'id' => :indonesian,
|
55
|
+
'iu' => :inuktitut,
|
56
|
+
'it' => :italian,
|
57
|
+
'ja' => :japanese,
|
58
|
+
'kn' => :kannada,
|
59
|
+
'kk' => :kazakh,
|
60
|
+
'km' => :khmer,
|
61
|
+
'ko' => :korean,
|
62
|
+
'ku' => :kurdish,
|
63
|
+
'ky' => :kyrgyz,
|
64
|
+
'lo' => :laothian,
|
65
|
+
'lv' => :latvian,
|
66
|
+
'lt' => :lithuanian,
|
67
|
+
'mk' => :macedonian,
|
68
|
+
'ms' => :malay,
|
69
|
+
'ml' => :malayalam,
|
70
|
+
'mt' => :maltese,
|
71
|
+
'mr' => :marathi,
|
72
|
+
'mn' => :mongolian,
|
73
|
+
'ne' => :nepali,
|
74
|
+
'no' => :norwegian,
|
75
|
+
'or' => :oriya,
|
76
|
+
'ps' => :pashto,
|
77
|
+
'fa' => :persian,
|
78
|
+
'pl' => :polish,
|
79
|
+
'pt-PT' => :portuguese,
|
80
|
+
'pa' => :punjabi,
|
81
|
+
'ro' => :romanian,
|
82
|
+
'ru' => :russian,
|
83
|
+
'sa' => :sanskrit,
|
84
|
+
'sr' => :serbian,
|
85
|
+
'sd' => :sindhi,
|
86
|
+
'si' => :sinhalese,
|
87
|
+
'sk' => :slovak,
|
88
|
+
'sl' => :slovenian,
|
89
|
+
'es' => :spanish,
|
90
|
+
'sw' => :swahili,
|
91
|
+
'sv' => :swedish,
|
92
|
+
'tg' => :tajik,
|
93
|
+
'ta' => :tamil,
|
94
|
+
'tl' => :tagalog,
|
95
|
+
'te' => :telugu,
|
96
|
+
'th' => :thai,
|
97
|
+
'bo' => :tibetan,
|
98
|
+
'tr' => :turkish,
|
99
|
+
'uk' => :ukrainian,
|
100
|
+
'ur' => :urdu,
|
101
|
+
'uz' => :uzbek,
|
102
|
+
'ug' => :uighur,
|
103
|
+
'vi' => :vietnamese,
|
104
|
+
'' => :unknown
|
105
|
+
}
|
14
106
|
|
15
107
|
#
|
16
108
|
# Determines the language of a string
|
@@ -48,7 +140,7 @@ module Babylon
|
|
48
140
|
reliable = result['responseData']['isReliable']
|
49
141
|
raise UncertaintyError if certainty < min_certainty || (ensure_reliability && !reliable)
|
50
142
|
|
51
|
-
result['responseData']['language'];
|
143
|
+
LANGUAGES[result['responseData']['language']];
|
52
144
|
end
|
53
145
|
|
54
146
|
# Method to get the raw result Google sends us.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babylon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Thorben Schr\xC3\xB6der"
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
kX4sVHCM
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2008-10-
|
33
|
+
date: 2008-10-17 00:00:00 +02:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|