Skip to content

Commit b8bb6c3

Browse files
committed
Update examples
1 parent 410b4eb commit b8bb6c3

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Get your personal API key by signing up at https://detectlanguage.com
2525

2626
```ruby
2727
DetectLanguage.configure do |config|
28-
config.api_key = "YOUR API KEY"
28+
config.api_key = 'YOUR API KEY'
2929
end
3030
```
3131

@@ -34,27 +34,27 @@ end
3434
### Language detection
3535

3636
```ruby
37-
DetectLanguage.detect("Buenos dias señor")
37+
DetectLanguage.detect('Dolce far niente')
3838
```
3939

4040
#### Result
4141

4242
```ruby
43-
[{"language"=>"es", "score"=>0.95}]
43+
[{"language" => "it", "score" => 0.5074}]
4444
```
4545

4646
### Language code detection
4747

4848
If you need just a language code you can use `detect_code`.
4949

5050
```ruby
51-
DetectLanguage.detect_code("Buenos dias señor")
51+
DetectLanguage.detect_code('Dolce far niente')
5252
```
5353

5454
#### Result
5555

5656
```ruby
57-
"es"
57+
"it"
5858
```
5959

6060
### Batch detection
@@ -64,16 +64,15 @@ This method is significantly faster than doing one request per text.
6464
To use batch detection just pass array of texts to `detect_batch` method.
6565

6666
```ruby
67-
DetectLanguage.detect_batch(["Buenos dias señor", "Labas rytas"])
67+
DetectLanguage.detect_batch(['Dolce far niente', 'Labas rytas'])
6868
```
6969

7070
#### Result
7171

7272
Result is array of detections in the same order as the texts were passed.
7373

7474
```ruby
75-
[ [{"language"=>"es", "score"=>0.95}],
76-
[{"language"=>"lt", "score"=>0.98}] ]
75+
[[{"language" => "it", "score" => 0.5074}], [{"language" => "lt", "score" => 0.3063}]]
7776
```
7877

7978
### Getting your account status

spec/lib/detect_language_spec.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
describe '.config' do
1414
subject { described_class.config }
1515

16-
it 'has default configuration values' do
17-
expect(subject.base_url).to eq('https://ws.detectlanguage.com/v3/')
18-
expect(subject.user_agent).to eq("detectlanguage-ruby/#{DetectLanguage::VERSION}")
19-
end
16+
it { is_expected.to be_a(DetectLanguage::Configuration) }
2017
end
2118

2219
describe '.detect' do

0 commit comments

Comments
 (0)