Skip to content

Commit 532c029

Browse files
author
remi Taylor
authored
Merge pull request #46 from GoogleCloudPlatform/speech
Ruby samples for Google Cloud Speech API
2 parents e9741dc + 0910cc3 commit 532c029

13 files changed

Lines changed: 353 additions & 0 deletions

File tree

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
# http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint
2525

2626
AllCops:
27+
# Allow Ruby 2 features, eg. named parameters
2728
TargetRubyVersion: 2.1
29+
Exclude:
30+
# ignore generated protobuf files
31+
- "**/*_pb.rb"
32+
# ignore any code in 'generated' directories
33+
- "*/generated/**/*.rb"
2834

2935
# Prefer double quotes for consistency (regardless of interpolation)
3036
Style/StringLiterals:

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ env:
3535
- TEST_DIR=bigquery
3636
- TEST_DIR=datastore
3737
- TEST_DIR=logging
38+
- TEST_DIR=speech
3839
- TEST_DIR=translate
3940
- TEST_DIR=language
4041
- TEST_DIR=appengine/endpoints

speech/.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--tty --color --format documentation --order random

speech/Gemfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2016 Google, Inc
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
source "https://rubygems.org"
16+
17+
gem "google-api-client"
18+
19+
group :test do
20+
gem "rake"
21+
gem "rubocop"
22+
gem "rspec"
23+
end

speech/Gemfile.lock

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
addressable (2.4.0)
5+
ast (2.3.0)
6+
diff-lcs (1.2.5)
7+
faraday (0.9.2)
8+
multipart-post (>= 1.2, < 3)
9+
google-api-client (0.9.13)
10+
addressable (~> 2.3)
11+
googleauth (~> 0.5)
12+
httpclient (~> 2.7)
13+
hurley (~> 0.1)
14+
memoist (~> 0.11)
15+
mime-types (>= 1.6)
16+
representable (~> 2.3.0)
17+
retriable (~> 2.0)
18+
googleauth (0.5.1)
19+
faraday (~> 0.9)
20+
jwt (~> 1.4)
21+
logging (~> 2.0)
22+
memoist (~> 0.12)
23+
multi_json (~> 1.11)
24+
os (~> 0.9)
25+
signet (~> 0.7)
26+
httpclient (2.8.2.3)
27+
hurley (0.2)
28+
jwt (1.5.4)
29+
little-plugger (1.1.4)
30+
logging (2.1.0)
31+
little-plugger (~> 1.1)
32+
multi_json (~> 1.10)
33+
memoist (0.15.0)
34+
mime-types (3.1)
35+
mime-types-data (~> 3.2015)
36+
mime-types-data (3.2016.0521)
37+
multi_json (1.12.1)
38+
multipart-post (2.0.0)
39+
os (0.9.6)
40+
parser (2.3.1.2)
41+
ast (~> 2.2)
42+
powerpack (0.1.1)
43+
rainbow (2.1.0)
44+
rake (11.2.2)
45+
representable (2.3.0)
46+
uber (~> 0.0.7)
47+
retriable (2.1.0)
48+
rspec (3.5.0)
49+
rspec-core (~> 3.5.0)
50+
rspec-expectations (~> 3.5.0)
51+
rspec-mocks (~> 3.5.0)
52+
rspec-core (3.5.2)
53+
rspec-support (~> 3.5.0)
54+
rspec-expectations (3.5.0)
55+
diff-lcs (>= 1.2.0, < 2.0)
56+
rspec-support (~> 3.5.0)
57+
rspec-mocks (3.5.0)
58+
diff-lcs (>= 1.2.0, < 2.0)
59+
rspec-support (~> 3.5.0)
60+
rspec-support (3.5.0)
61+
rubocop (0.42.0)
62+
parser (>= 2.3.1.1, < 3.0)
63+
powerpack (~> 0.1)
64+
rainbow (>= 1.99.1, < 3.0)
65+
ruby-progressbar (~> 1.7)
66+
unicode-display_width (~> 1.0, >= 1.0.1)
67+
ruby-progressbar (1.8.1)
68+
signet (0.7.3)
69+
addressable (~> 2.3)
70+
faraday (~> 0.9)
71+
jwt (~> 1.5)
72+
multi_json (~> 1.10)
73+
uber (0.0.15)
74+
unicode-display_width (1.1.0)
75+
76+
PLATFORMS
77+
ruby
78+
79+
DEPENDENCIES
80+
google-api-client
81+
rake
82+
rspec
83+
rubocop
84+
85+
BUNDLED WITH
86+
1.12.5

speech/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
2+
3+
# Google Cloud Speech API Ruby Samples
4+
5+
[Sign up for the Alpha](https://services.google.com/fb/forms/speech-api-alpha/).
6+
7+
The [Cloud Speech API](https://cloud.google.com/speech/) enables easy
8+
integration of Google speech recognition technologies into developer applications.
9+
10+
## Run sample
11+
12+
To run the sample, first install dependencies:
13+
14+
bundle install
15+
16+
Run the sample:
17+
18+
bundle exec ruby speech_samples.rb
19+
20+
Usage:
21+
22+
Usage: ruby speech_samples.rb <command> [arguments]
23+
24+
Commands:
25+
recognize <audio-file.raw>
26+
async_recognize <audio-file.raw>
27+
async_recognize_results <operation name>
28+
29+
Examples:
30+
31+
$ bundle exec ruby speech_samples.rb recognize audio_files/audio.raw
32+
Text: how old is the Brooklyn Bridge

speech/Rakefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2016 Google, Inc
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
require "rspec/core/rake_task"
16+
RSpec::Core::RakeTask.new(:spec)
17+
18+
require "rubocop/rake_task"
19+
RuboCop::RakeTask.new
20+
21+
task default: :spec

speech/audio_files/audio.flac

32.7 KB
Binary file not shown.

speech/audio_files/audio.raw

56.6 KB
Binary file not shown.

speech/audio_files/audio2.raw

156 KB
Binary file not shown.

0 commit comments

Comments
 (0)