that_language-client 0.1.0 → 0.1.1

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: 522498cda5d797597000b24c43684a9d17655e5e
4
- data.tar.gz: 6e4021897803f96158e2bca7d3a21da918ea6884
3
+ metadata.gz: ede343e2d2d2065c8eec215ad7434eed345c0fce
4
+ data.tar.gz: 725f13a0d292bcc889ee3bddf8951f47385f64bb
5
5
  SHA512:
6
- metadata.gz: 12ae04938dacf35e7a4a05a2600982776893998282f41544770ddd3d9e7bdff7cbabacf715c01b6cafc51601d7c2ec0e4e2eb09d4f5f30b6c0ba9bb57b090acd
7
- data.tar.gz: 574086466ac42cd335bce967e749890a89dbfafbfbc177b554a43fa29e3002e250551c8a427ed6f3eddaa5e8b6423158b00a2170a0e640efa7d4cd4b7565fe59
6
+ metadata.gz: 49442abaaeae4c90371c03ffd294cb7fe8ea75306328d25714bceb56474c79eb3918e4aa6de71967719ef8e3e28e72b56ccc26867ba8dce359b672b6cbed3548
7
+ data.tar.gz: b0cac92492926a67f690af4479716852de3dd0fb4517b18f4996b27074d6be86c3fbd5da9359b481f9365752d95d04c346245c1aa00ef1ab24036a535a6c0c3b
data/README.md CHANGED
@@ -1,15 +1,11 @@
1
- # DetectLanguage::Client
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/detect_language/client`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
1
+ # ThatLanguage::Client
6
2
 
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
10
6
 
11
7
  ```ruby
12
- gem 'detect_language-client'
8
+ gem 'that_language-client'
13
9
  ```
14
10
 
15
11
  And then execute:
@@ -18,21 +14,128 @@ And then execute:
18
14
 
19
15
  Or install it yourself as:
20
16
 
21
- $ gem install detect_language-client
17
+ $ gem install that_language-client
18
+
19
+ ## Examples
20
+
21
+ ```ruby
22
+ text = "This is just a random english sentence."
23
+
24
+ ## == Language
25
+
26
+ ThatLanguage.language(text)
27
+ # => "English"
28
+
29
+
30
+ ## == LanguageCode
31
+
32
+ ThatLanguage.language_code(text)
33
+ # => "en"
34
+
35
+
36
+ ## == Detect
37
+
38
+ detect = ThatLanguage.detect(text)
39
+ # => #<ThatLanguage::Client::DetectQuery:...
40
+
41
+ detect.language
42
+ # => "English"
43
+
44
+ detect.language_code
45
+ # => "en"
46
+
47
+ detect.confidence
48
+ # => 0.5631093821386951
49
+
50
+ detect.to_h
51
+ # => {"language"=>"English", "language_code"=>"en", "confidence"=>0.5631093821386951}
22
52
 
23
- ## Usage
24
53
 
25
- TODO: Write usage instructions here
54
+ ## == Details
55
+
56
+ details = ThatLanguage.details(text)
57
+ # => #<ThatLanguage::Client::DetailsQuery:...
58
+
59
+ winner = details.winner
60
+ # => OpenStruct
61
+
62
+ winner.language
63
+ # => "English"
64
+
65
+ winner.language_code
66
+ # => "en"
67
+
68
+ winner.confidence
69
+ # => 0.5631093821386951
70
+
71
+ winner.value
72
+ # => 3.9417656749708656
73
+
74
+ winner.hit_ratio
75
+ # => 0.8571428571428571
76
+
77
+ winner.hit_count
78
+ # => 6
79
+
80
+ winner.words_count
81
+ # => 7
82
+
83
+ results = details.results
84
+ # => [#<OpenStruct, #<OpenStruct, ...]
85
+
86
+ details.to_h
87
+ # =>
88
+ # {
89
+ # "results" => [
90
+ # {
91
+ # "language"=>"English",
92
+ # "language_code"=>"en",
93
+ # "confidence"=>0.5631093821386951,
94
+ # "value"=>3.9417656749708656,
95
+ # "hit_ratio"=>0.8571428571428571,
96
+ # "hit_count"=>6,
97
+ # "words_count"=>7
98
+ # },
99
+ # {
100
+ # "language"=>"Sundanese",
101
+ # "language_code"=>"su",
102
+ # "confidence"=>0.26101716738575337,
103
+ # "value"=>1.8271201717002734,
104
+ # "hit_ratio"=>0.7142857142857143,
105
+ # "hit_count"=>5,
106
+ # "words_count"=>7
107
+ # },
108
+ # # ...
109
+ # ]
110
+ # }
111
+ ```
112
+
113
+ ## Configure
114
+
115
+ Configure the host to use:
116
+
117
+ ```ruby
118
+ ThatLanguage::Client.configure do |config|
119
+ config.host = "my-custom-that-language-api.com"
120
+ end
121
+ ```
26
122
 
27
123
  ## Development
28
124
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
125
+ After checking out the repo, run `bin/setup` to install dependencies.
126
+ Then, run `rake rspec` to run the tests.
127
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
128
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
129
+ To install this gem onto your local machine, run `bundle exec rake install`.
130
+ To release a new version, update the version number in `version.rb`, and then run
131
+ `bundle exec rake release`, which will create a git tag for the version,
132
+ push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
133
 
33
134
  ## Contributing
34
135
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/detect_language-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
136
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Deradon/that_language-client.
137
+ This project is intended to be a safe, welcoming space for collaboration,
138
+ and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
139
 
37
140
 
38
141
  ## License
@@ -4,7 +4,7 @@ module ThatLanguage
4
4
  attr_accessor :host
5
5
 
6
6
  def host
7
- @host ||= "detect-language.ruby-on-rails.guru"
7
+ @host ||= "that-language-api.ruby-on-rails.guru"
8
8
  end
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module ThatLanguage
2
2
  class Client
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: that_language-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Helm