tongues 0.0.13 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0ebfb2f5ac9c3aa1e4ac263b2edcf13949222bc
4
- data.tar.gz: 5c714c36b58d490cd3e07b6e7136f2bd905fc836
3
+ metadata.gz: 6825c9c2ee360890acdc6776da6359a910b9ab65
4
+ data.tar.gz: 945c1a44b60a9ae7b5b1b68c2a82983630b471f3
5
5
  SHA512:
6
- metadata.gz: e5f8849b5cdab263b2b91a145cf1f47dc1e81682e8c0b2ece34d95a9a472f63909fce9b3124577a3581d98c3690cf33a91bd67f6c91c505f6b35b8d7481516cc
7
- data.tar.gz: 91e8e069f0461640ba4f0549a29d54f23543cb3bd96157927e689af728fc032fa0e8b78c2315d4fc0a92b4f1bd8ed353fb36f50ec58672004959efb4071ff551
6
+ metadata.gz: 1859b6f514514545d815fa57c20a35bbd1f3530f2ddd9bb5e54a9e677d01cc6db31ae01fbd803a75b457ef6d558ea90da15c8e1d16236bacfdffdad91bfac4a7
7
+ data.tar.gz: ba6867cbaaea58c1bb670f84cd376924d32c55ec03b8b38f346189367073dcc4433b41cd2fef424be4b9cdbd86e82f800c20c78bc3e1977f0142cfc45f5cd612
data/.idea/tongues.iml CHANGED
@@ -19,10 +19,13 @@
19
19
  <orderEntry type="library" scope="PROVIDED" name="activerecord (v4.0.0, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
20
20
  <orderEntry type="library" scope="PROVIDED" name="activerecord-deprecated_finders (v1.0.3, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
21
21
  <orderEntry type="library" scope="PROVIDED" name="activesupport (v4.0.0, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.5, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
22
23
  <orderEntry type="library" scope="PROVIDED" name="arel (v4.0.2, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
23
24
  <orderEntry type="library" scope="PROVIDED" name="atomic (v1.1.15, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
24
25
  <orderEntry type="library" scope="PROVIDED" name="builder (v3.1.4, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
25
26
  <orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="crack (v0.4.2, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
26
29
  <orderEntry type="library" scope="PROVIDED" name="erubis (v2.7.0, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
27
30
  <orderEntry type="library" scope="PROVIDED" name="hike (v1.2.3, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
28
31
  <orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.9, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
@@ -36,6 +39,11 @@
36
39
  <orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.2, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
37
40
  <orderEntry type="library" scope="PROVIDED" name="rails (v4.0.1.rc3, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
38
41
  <orderEntry type="library" scope="PROVIDED" name="railties (v4.0.0, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v2.14.1, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.14.8, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.14.5, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.14.6, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.1, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
39
47
  <orderEntry type="library" scope="PROVIDED" name="sprockets (v2.11.0, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
40
48
  <orderEntry type="library" scope="PROVIDED" name="sprockets-rails (v2.0.1, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
41
49
  <orderEntry type="library" scope="PROVIDED" name="thor (v0.18.1, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
@@ -43,6 +51,8 @@
43
51
  <orderEntry type="library" scope="PROVIDED" name="tilt (v1.4.1, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
44
52
  <orderEntry type="library" scope="PROVIDED" name="treetop (v1.4.15, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
45
53
  <orderEntry type="library" scope="PROVIDED" name="tzinfo (v0.3.39, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="vcr (v2.8.0, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="webmock (v1.17.4, RVM: ruby-2.0.0-p247 [global]) [gem]" level="application" />
46
56
  </component>
47
57
  </module>
48
58
 
@@ -1,3 +1,4 @@
1
+ require 'rails'
1
2
  require 'net/http'
2
3
  require 'cgi'
3
4
  require 'json'
@@ -1,3 +1,3 @@
1
1
  module Tongues
2
- VERSION = "0.0.13"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,120 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tongues do
4
+ before do
5
+ Tongues::Configuration.api_key= 'demo'
6
+ VCR.insert_cassette('tongues')
7
+ end
8
+
9
+ after do
10
+ VCR.eject_cassette
11
+ end
12
+
13
+ describe 'language detection on a String' do
14
+ it 'returns a language (english)' do
15
+ 'this is an english text'.tongue.should == 'ENGLISH'
16
+ end
17
+
18
+ it 'returns a language (french)' do
19
+ 'ceci est un texte en français'.tongue.should == 'FRENCH'
20
+ end
21
+
22
+ it 'returns a language (spanish)' do
23
+ 'este es un texto español'.tongue.should == 'SPANISH'
24
+ end
25
+
26
+ it 'returns a language (russian)' do
27
+ 'это является русский текст'.tongue.should == 'RUSSIAN'
28
+ end
29
+
30
+ it 'returns a language code (english)' do
31
+ 'this is an english text'.tongue_code.should == 'en'
32
+ end
33
+
34
+ it 'returns a language code (french)' do
35
+ 'ceci est un texte en français'.tongue_code.should == 'fr'
36
+ end
37
+
38
+ it 'returns a language code (spanish)' do
39
+ 'este es un texto español'.tongue_code.should == 'es'
40
+ end
41
+
42
+ it 'returns a language code (russian)' do
43
+ 'это является русский текст'.tongue_code.should == 'ru'
44
+ end
45
+
46
+ it 'returns the confidence in the detection (english)' do
47
+ 'this is an english text'.tongue_confidence.should == 21.33
48
+ end
49
+
50
+ it 'returns the confidence in the detection (french)' do
51
+ 'ceci est un texte en français'.tongue_confidence.should == 9.24
52
+ end
53
+
54
+ it 'returns the confidence in the detection (spanish)' do
55
+ 'este es un texto español'.tongue_confidence.should == 19.29
56
+ end
57
+
58
+ it 'returns the confidence in the detection (russian)' do
59
+ 'это является русский текст'.tongue_confidence.should == 12.69
60
+ end
61
+
62
+ it 'returns nil for a text of unknown language' do
63
+ '1234'.tongue.should == nil
64
+ end
65
+ end
66
+
67
+ describe 'language detection on a Symbol' do
68
+ it 'returns a language (english)' do
69
+ :'this is an english text'.tongue.should == 'ENGLISH'
70
+ end
71
+
72
+ it 'returns a language (french)' do
73
+ :'ceci est un texte en français'.tongue.should == 'FRENCH'
74
+ end
75
+
76
+ it 'returns a language (spanish)' do
77
+ :'este es un texto español'.tongue.should == 'SPANISH'
78
+ end
79
+
80
+ it 'returns a language (russian)' do
81
+ :'это является русский текст'.tongue.should == 'RUSSIAN'
82
+ end
83
+
84
+ it 'returns a language code (english)' do
85
+ :'this is an english text'.tongue_code.should == 'en'
86
+ end
87
+
88
+ it 'returns a language code (french)' do
89
+ :'ceci est un texte en français'.tongue_code.should == 'fr'
90
+ end
91
+
92
+ it 'returns a language code (spanish)' do
93
+ :'este es un texto español'.tongue_code.should == 'es'
94
+ end
95
+
96
+ it 'returns a language code (russian)' do
97
+ :'это является русский текст'.tongue_code.should == 'ru'
98
+ end
99
+
100
+ it 'returns the confidence in the detection (english)' do
101
+ :'this is an english text'.tongue_confidence.should == 21.33
102
+ end
103
+
104
+ it 'returns the confidence in the detection (french)' do
105
+ :'ceci est un texte en français'.tongue_confidence.should == 9.24
106
+ end
107
+
108
+ it 'returns the confidence in the detection (spanish)' do
109
+ :'este es un texto español'.tongue_confidence.should == 19.29
110
+ end
111
+
112
+ it 'returns the confidence in the detection (russian)' do
113
+ :'это является русский текст'.tongue_confidence.should == 12.69
114
+ end
115
+
116
+ it 'returns nil for a text of unknown language' do
117
+ :'1234'.tongue.should == nil
118
+ end
119
+ end
120
+ end
data/tongues.gemspec CHANGED
@@ -20,6 +20,9 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake', '~> 0'
23
+ spec.add_development_dependency 'rspec'
24
+ spec.add_development_dependency 'vcr'
25
+ spec.add_development_dependency 'webmock'
23
26
 
24
27
  spec.add_runtime_dependency 'rails', '>= 3.2.3'
25
28
  spec.add_runtime_dependency 'json', '>= 0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tongues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Zicat
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: rails
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -75,12 +117,8 @@ extensions: []
75
117
  extra_rdoc_files: []
76
118
  files:
77
119
  - .gitignore
78
- - .idea/encodings.xml
79
- - .idea/misc.xml
80
- - .idea/modules.xml
81
120
  - .idea/scopes/scope_settings.xml
82
121
  - .idea/tongues.iml
83
- - .idea/vcs.xml
84
122
  - Gemfile
85
123
  - LICENSE.txt
86
124
  - README.md
@@ -97,6 +135,7 @@ files:
97
135
  - lib/tongues/core_ext/symbol.rb
98
136
  - lib/tongues/tongue.rb
99
137
  - lib/tongues/version.rb
138
+ - spec/tongues_spec.rb
100
139
  - tongues.gemspec
101
140
  homepage: https://github.com/alexzicat
102
141
  licenses:
@@ -122,5 +161,6 @@ rubygems_version: 2.2.2
122
161
  signing_key:
123
162
  specification_version: 4
124
163
  summary: Small language detection gem
125
- test_files: []
164
+ test_files:
165
+ - spec/tongues_spec.rb
126
166
  has_rdoc:
data/.idea/encodings.xml DELETED
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
- </project>
5
-
data/.idea/misc.xml DELETED
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.0.0-p247 [global]" project-jdk-type="RUBY_SDK" />
4
- </project>
5
-
data/.idea/modules.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/tongues.iml" filepath="$PROJECT_DIR$/.idea/tongues.iml" />
6
- </modules>
7
- </component>
8
- </project>
9
-
data/.idea/vcs.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="" />
5
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
6
- </component>
7
- </project>
8
-