azure_stt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +33 -0
- data/.gitignore +56 -0
- data/.rubocop.yml +22 -0
- data/CHANGELOG.md +28 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +141 -0
- data/LICENSE +21 -0
- data/README.md +129 -0
- data/Rakefile +27 -0
- data/azure_stt.gemspec +29 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docs/AzureBatchTranscription.html +301 -0
- data/docs/AzureBatchTranscription/Configuration.html +212 -0
- data/docs/AzureSTT.html +305 -0
- data/docs/AzureSTT/Client.html +1008 -0
- data/docs/AzureSTT/Configuration.html +282 -0
- data/docs/AzureSTT/Error.html +305 -0
- data/docs/AzureSTT/Models.html +135 -0
- data/docs/AzureSTT/Models/Base.html +139 -0
- data/docs/AzureSTT/Models/CombinedRecognizedPhrases.html +538 -0
- data/docs/AzureSTT/Models/File.html +794 -0
- data/docs/AzureSTT/Models/RecognizedPhrase.html +769 -0
- data/docs/AzureSTT/Models/Report.html +384 -0
- data/docs/AzureSTT/Models/Result.html +796 -0
- data/docs/AzureSTT/Models/Sentence.html +615 -0
- data/docs/AzureSTT/Models/Transcription.html +1415 -0
- data/docs/AzureSTT/Models/Word.html +615 -0
- data/docs/AzureSTT/NetError.html +159 -0
- data/docs/AzureSTT/Parsers.html +128 -0
- data/docs/AzureSTT/Parsers/Base.html +404 -0
- data/docs/AzureSTT/Parsers/CombinedRecognizedPhrases.html +156 -0
- data/docs/AzureSTT/Parsers/File.html +156 -0
- data/docs/AzureSTT/Parsers/RecognizedPhrase.html +156 -0
- data/docs/AzureSTT/Parsers/Report.html +156 -0
- data/docs/AzureSTT/Parsers/Result.html +156 -0
- data/docs/AzureSTT/Parsers/Sentence.html +156 -0
- data/docs/AzureSTT/Parsers/Transcription.html +156 -0
- data/docs/AzureSTT/Parsers/Word.html +156 -0
- data/docs/AzureSTT/ServiceError.html +159 -0
- data/docs/AzureSTT/Session.html +767 -0
- data/docs/AzureSTT/Transcription.html +635 -0
- data/docs/AzureSTT/Types.html +116 -0
- data/docs/AzureStt_.html +121 -0
- data/docs/_index.html +392 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +201 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +201 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +707 -0
- data/docs/top-level-namespace.html +110 -0
- data/env.sample +2 -0
- data/lib/azure_stt.rb +20 -0
- data/lib/azure_stt/client.rb +189 -0
- data/lib/azure_stt/configuration.rb +28 -0
- data/lib/azure_stt/errors.rb +25 -0
- data/lib/azure_stt/models.rb +30 -0
- data/lib/azure_stt/models/base.rb +27 -0
- data/lib/azure_stt/models/combined_recognized_phrases.rb +48 -0
- data/lib/azure_stt/models/file.rb +72 -0
- data/lib/azure_stt/models/recognized_phrase.rb +70 -0
- data/lib/azure_stt/models/report.rb +31 -0
- data/lib/azure_stt/models/result.rb +76 -0
- data/lib/azure_stt/models/sentence.rb +53 -0
- data/lib/azure_stt/models/transcription.rb +185 -0
- data/lib/azure_stt/models/word.rb +54 -0
- data/lib/azure_stt/parsers.rb +19 -0
- data/lib/azure_stt/parsers/base.rb +42 -0
- data/lib/azure_stt/parsers/combined_recognized_phrases.rb +28 -0
- data/lib/azure_stt/parsers/file.rb +28 -0
- data/lib/azure_stt/parsers/recognized_phrase.rb +45 -0
- data/lib/azure_stt/parsers/report.rb +25 -0
- data/lib/azure_stt/parsers/result.rb +56 -0
- data/lib/azure_stt/parsers/sentence.rb +45 -0
- data/lib/azure_stt/parsers/transcription.rb +34 -0
- data/lib/azure_stt/parsers/word.rb +28 -0
- data/lib/azure_stt/session.rb +100 -0
- data/lib/azure_stt/version.rb +5 -0
- metadata +158 -0
@@ -0,0 +1,201 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.26
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="azurestt">azure_stt</h1>
|
61
|
+
<p>API Wrapper for the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-speech-to-text">Microsoft Azure Speech Services Speech-to-text REST API 3.0</a> (Cognitive Services).</p>
|
62
|
+
|
63
|
+
<h2 id="installation">Installation</h2>
|
64
|
+
|
65
|
+
<p>Add this line to your application’s Gemfile:</p>
|
66
|
+
|
67
|
+
<p><code>ruby
|
68
|
+
gem 'azure_stt'
|
69
|
+
</code></p>
|
70
|
+
|
71
|
+
<p>And then execute:</p>
|
72
|
+
|
73
|
+
<p><code>bash
|
74
|
+
bundle
|
75
|
+
</code></p>
|
76
|
+
|
77
|
+
<p>Or install it yourself as:</p>
|
78
|
+
|
79
|
+
<p><code>bash
|
80
|
+
gem install azure_stt
|
81
|
+
</code></p>
|
82
|
+
|
83
|
+
<h2 id="azure-speech-to-text-subscription-key">Azure Speech-to-text Subscription key</h2>
|
84
|
+
|
85
|
+
<p>To be able to use the gem, you must have a subscription key.
|
86
|
+
You can generate one on your Azure account.</p>
|
87
|
+
|
88
|
+
<ul>
|
89
|
+
<li>If you don’t have an Azure account, you can create one for free on <a href="https://azure.microsoft.com/en-us/free/">this page</a>.</li>
|
90
|
+
<li>Once logged on your <a href="https://portal.azure.com/">Azure portal</a>, subscribe to SpeechServices in Microsoft Cognitive Service.</li>
|
91
|
+
<li>You will find two subscription keys available in ‘RESOURCE MANAGEMENT > Keys’ (‘KEY 1’ and ‘KEY 2’).</li>
|
92
|
+
</ul>
|
93
|
+
|
94
|
+
<h2 id="usage">Usage</h2>
|
95
|
+
|
96
|
+
<h3 id="configuration">Configuration</h3>
|
97
|
+
|
98
|
+
<p>Two environment variables are used:</p>
|
99
|
+
|
100
|
+
<ul>
|
101
|
+
<li>
|
102
|
+
<p>‘REGION’: the region of your subscription</p>
|
103
|
+
</li>
|
104
|
+
<li>
|
105
|
+
<p>‘SUBSCRIPTION_KEY’: the API key you can generate on your Azure account.</p>
|
106
|
+
</li>
|
107
|
+
</ul>
|
108
|
+
|
109
|
+
<p>You can look at the file <code>env.sample</code> and change the values.
|
110
|
+
If you do not want to use environment variables, you can configure the values like so:</p>
|
111
|
+
|
112
|
+
<p><code>ruby
|
113
|
+
AzureSTT.configure do |config|
|
114
|
+
config.region = 'your_region'
|
115
|
+
config.subscription_key = 'your_key'
|
116
|
+
end
|
117
|
+
</code></p>
|
118
|
+
|
119
|
+
<p>Finally, the class <code>AzureSTT::Session</code> uses by the default the values from the configuration, but you can initialize the session with custom values:</p>
|
120
|
+
|
121
|
+
<p><code>ruby
|
122
|
+
session = AzureSTT::Session.new(region: 'your_region', subscription_key: 'your_key')
|
123
|
+
</code></p>
|
124
|
+
|
125
|
+
<h3 id="start-a-transcription">start a transcription</h3>
|
126
|
+
|
127
|
+
<p>```ruby
|
128
|
+
require ‘azure_stt’</p>
|
129
|
+
|
130
|
+
<p>properties = {
|
131
|
+
“diarizationEnabled” => false,
|
132
|
+
“wordLevelTimestampsEnabled” => false,
|
133
|
+
“punctuationMode” => “DictatedAndAutomatic”,
|
134
|
+
“profanityFilterMode” => “Masked”
|
135
|
+
}</p>
|
136
|
+
|
137
|
+
<p>content_urls = [ ‘https://path.com/audio.ogg’, ‘https://path.com/audio1.ogg’]</p>
|
138
|
+
|
139
|
+
<p>session = AzureSTT::Session.new</p>
|
140
|
+
|
141
|
+
<p>transcription = session.create_transcription(
|
142
|
+
content_urls: content_urls,
|
143
|
+
properties: properties,
|
144
|
+
locale: ‘en-US’,
|
145
|
+
display_name: ‘The name of the transcription’)</p>
|
146
|
+
|
147
|
+
<h1 id="you-can-the-retrieve-the-results-of-your-transcription-with-the-id">You can the retrieve the results of your transcription with the id</h1>
|
148
|
+
<p>puts transcription.id
|
149
|
+
# Outputs ‘your_transcription_id’</p>
|
150
|
+
|
151
|
+
<p>```</p>
|
152
|
+
|
153
|
+
<h3 id="get-a-transcription">Get a transcription</h3>
|
154
|
+
|
155
|
+
<p>```ruby
|
156
|
+
require ‘azure_stt’</p>
|
157
|
+
|
158
|
+
<p>session = AzureSTT::Session.new</p>
|
159
|
+
|
160
|
+
<p>transcription = session.get_transcription(‘your_transcription_id’)</p>
|
161
|
+
|
162
|
+
<h1 id="returns">Returns</h1>
|
163
|
+
<p># #<AzureSTT::Transcription id=”d35a802d-70ae-4358-a35d-b5faa0c75457”
|
164
|
+
# # model=”” properties=# # “wordLevelTimestampsEnabled”=>false, “channels”=>[0, 1],
|
165
|
+
# # “punctuationMode”=>”DictatedAndAutomatic”, “profanityFilterMode”=>”Masked”,
|
166
|
+
# # “duration”=>”PT5M18S”
|
167
|
+
# # links=<a href="“files”=>”https://uscentral.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/d35a802d-70ae-4358-a35d-b5faa0c75457/files”" target="_parent" title="“files”=>”https://uscentral.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/d35a802d-70ae-4358-a35d-b5faa0c75457/files”">“files”=>”https://uscentral.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/d35a802d-70ae-4358-a35d-b5faa0c75457/files”</a>
|
168
|
+
# # last_action_date_time=#<Date: 2020-05-31 ((2459366j,0s,0n),+0s,2299161j)> created_date_time=#<Date: 2020-05-31 ((2459366j,0s,0n),+0s,2299161j)>
|
169
|
+
# # status=”Succeeded” locale=”en-US” display_name=”Transcription name” files=[]></p>
|
170
|
+
|
171
|
+
<p>if transcription.succeeded?
|
172
|
+
# You can then access to the text, for instance :
|
173
|
+
result = transcription.results.first
|
174
|
+
puts result.text
|
175
|
+
end
|
176
|
+
```</p>
|
177
|
+
|
178
|
+
<h2 id="development">Development</h2>
|
179
|
+
|
180
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
181
|
+
|
182
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
|
183
|
+
|
184
|
+
<h2 id="contributing">Contributing</h2>
|
185
|
+
|
186
|
+
<p>Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/azure_stt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the <a href="http://contributor-covenant.org">Contributor Covenant</a> code of conduct.</p>
|
187
|
+
|
188
|
+
<h2 id="code-of-conduct">Code of Conduct</h2>
|
189
|
+
|
190
|
+
<p>Everyone interacting in the AzureStt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the <a href="https://github.com/[USERNAME]/azure_stt/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
|
191
|
+
</div></div>
|
192
|
+
|
193
|
+
<div id="footer">
|
194
|
+
Generated on Thu Jun 24 14:16:27 2021 by
|
195
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
196
|
+
0.9.26 (ruby-2.6.6).
|
197
|
+
</div>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
</body>
|
201
|
+
</html>
|
data/docs/file_list.html
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="content">
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<ul id="full_list" class="file">
|
45
|
+
|
46
|
+
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
data/docs/frames.html
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.26</title>
|
6
|
+
</head>
|
7
|
+
<script type="text/javascript">
|
8
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
|
+
var name = match ? match[1] : 'index.html';
|
10
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
11
|
+
window.top.location = name;
|
12
|
+
</script>
|
13
|
+
<noscript>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
16
|
+
</noscript>
|
17
|
+
</html>
|
data/docs/index.html
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.26
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="azurestt">azure_stt</h1>
|
61
|
+
<p>API Wrapper for the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-speech-to-text">Microsoft Azure Speech Services Speech-to-text REST API 3.0</a> (Cognitive Services).</p>
|
62
|
+
|
63
|
+
<h2 id="installation">Installation</h2>
|
64
|
+
|
65
|
+
<p>Add this line to your application’s Gemfile:</p>
|
66
|
+
|
67
|
+
<p><code>ruby
|
68
|
+
gem 'azure_stt'
|
69
|
+
</code></p>
|
70
|
+
|
71
|
+
<p>And then execute:</p>
|
72
|
+
|
73
|
+
<p><code>bash
|
74
|
+
bundle
|
75
|
+
</code></p>
|
76
|
+
|
77
|
+
<p>Or install it yourself as:</p>
|
78
|
+
|
79
|
+
<p><code>bash
|
80
|
+
gem install azure_stt
|
81
|
+
</code></p>
|
82
|
+
|
83
|
+
<h2 id="azure-speech-to-text-subscription-key">Azure Speech-to-text Subscription key</h2>
|
84
|
+
|
85
|
+
<p>To be able to use the gem, you must have a subscription key.
|
86
|
+
You can generate one on your Azure account.</p>
|
87
|
+
|
88
|
+
<ul>
|
89
|
+
<li>If you don’t have an Azure account, you can create one for free on <a href="https://azure.microsoft.com/en-us/free/">this page</a>.</li>
|
90
|
+
<li>Once logged on your <a href="https://portal.azure.com/">Azure portal</a>, subscribe to SpeechServices in Microsoft Cognitive Service.</li>
|
91
|
+
<li>You will find two subscription keys available in ‘RESOURCE MANAGEMENT > Keys’ (‘KEY 1’ and ‘KEY 2’).</li>
|
92
|
+
</ul>
|
93
|
+
|
94
|
+
<h2 id="usage">Usage</h2>
|
95
|
+
|
96
|
+
<h3 id="configuration">Configuration</h3>
|
97
|
+
|
98
|
+
<p>Two environment variables are used:</p>
|
99
|
+
|
100
|
+
<ul>
|
101
|
+
<li>
|
102
|
+
<p>‘REGION’: the region of your subscription</p>
|
103
|
+
</li>
|
104
|
+
<li>
|
105
|
+
<p>‘SUBSCRIPTION_KEY’: the API key you can generate on your Azure account.</p>
|
106
|
+
</li>
|
107
|
+
</ul>
|
108
|
+
|
109
|
+
<p>You can look at the file <code>env.sample</code> and change the values.
|
110
|
+
If you do not want to use environment variables, you can configure the values like so:</p>
|
111
|
+
|
112
|
+
<p><code>ruby
|
113
|
+
AzureSTT.configure do |config|
|
114
|
+
config.region = 'your_region'
|
115
|
+
config.subscription_key = 'your_key'
|
116
|
+
end
|
117
|
+
</code></p>
|
118
|
+
|
119
|
+
<p>Finally, the class <code>AzureSTT::Session</code> uses by the default the values from the configuration, but you can initialize the session with custom values:</p>
|
120
|
+
|
121
|
+
<p><code>ruby
|
122
|
+
session = AzureSTT::Session.new(region: 'your_region', subscription_key: 'your_key')
|
123
|
+
</code></p>
|
124
|
+
|
125
|
+
<h3 id="start-a-transcription">start a transcription</h3>
|
126
|
+
|
127
|
+
<p>```ruby
|
128
|
+
require ‘azure_stt’</p>
|
129
|
+
|
130
|
+
<p>properties = {
|
131
|
+
“diarizationEnabled” => false,
|
132
|
+
“wordLevelTimestampsEnabled” => false,
|
133
|
+
“punctuationMode” => “DictatedAndAutomatic”,
|
134
|
+
“profanityFilterMode” => “Masked”
|
135
|
+
}</p>
|
136
|
+
|
137
|
+
<p>content_urls = [ ‘https://path.com/audio.ogg’, ‘https://path.com/audio1.ogg’]</p>
|
138
|
+
|
139
|
+
<p>session = AzureSTT::Session.new</p>
|
140
|
+
|
141
|
+
<p>transcription = session.create_transcription(
|
142
|
+
content_urls: content_urls,
|
143
|
+
properties: properties,
|
144
|
+
locale: ‘en-US’,
|
145
|
+
display_name: ‘The name of the transcription’)</p>
|
146
|
+
|
147
|
+
<h1 id="you-can-the-retrieve-the-results-of-your-transcription-with-the-id">You can the retrieve the results of your transcription with the id</h1>
|
148
|
+
<p>puts transcription.id
|
149
|
+
# Outputs ‘your_transcription_id’</p>
|
150
|
+
|
151
|
+
<p>```</p>
|
152
|
+
|
153
|
+
<h3 id="get-a-transcription">Get a transcription</h3>
|
154
|
+
|
155
|
+
<p>```ruby
|
156
|
+
require ‘azure_stt’</p>
|
157
|
+
|
158
|
+
<p>session = AzureSTT::Session.new</p>
|
159
|
+
|
160
|
+
<p>transcription = session.get_transcription(‘your_transcription_id’)</p>
|
161
|
+
|
162
|
+
<h1 id="returns">Returns</h1>
|
163
|
+
<p># #<AzureSTT::Transcription id=”d35a802d-70ae-4358-a35d-b5faa0c75457”
|
164
|
+
# # model=”” properties=# # “wordLevelTimestampsEnabled”=>false, “channels”=>[0, 1],
|
165
|
+
# # “punctuationMode”=>”DictatedAndAutomatic”, “profanityFilterMode”=>”Masked”,
|
166
|
+
# # “duration”=>”PT5M18S”
|
167
|
+
# # links=<a href="“files”=>”https://uscentral.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/d35a802d-70ae-4358-a35d-b5faa0c75457/files”" target="_parent" title="“files”=>”https://uscentral.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/d35a802d-70ae-4358-a35d-b5faa0c75457/files”">“files”=>”https://uscentral.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions/d35a802d-70ae-4358-a35d-b5faa0c75457/files”</a>
|
168
|
+
# # last_action_date_time=#<Date: 2020-05-31 ((2459366j,0s,0n),+0s,2299161j)> created_date_time=#<Date: 2020-05-31 ((2459366j,0s,0n),+0s,2299161j)>
|
169
|
+
# # status=”Succeeded” locale=”en-US” display_name=”Transcription name” files=[]></p>
|
170
|
+
|
171
|
+
<p>if transcription.succeeded?
|
172
|
+
# You can then access to the text, for instance :
|
173
|
+
result = transcription.results.first
|
174
|
+
puts result.text
|
175
|
+
end
|
176
|
+
```</p>
|
177
|
+
|
178
|
+
<h2 id="development">Development</h2>
|
179
|
+
|
180
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
181
|
+
|
182
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
|
183
|
+
|
184
|
+
<h2 id="contributing">Contributing</h2>
|
185
|
+
|
186
|
+
<p>Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/azure_stt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the <a href="http://contributor-covenant.org">Contributor Covenant</a> code of conduct.</p>
|
187
|
+
|
188
|
+
<h2 id="code-of-conduct">Code of Conduct</h2>
|
189
|
+
|
190
|
+
<p>Everyone interacting in the AzureStt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the <a href="https://github.com/[USERNAME]/azure_stt/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
|
191
|
+
</div></div>
|
192
|
+
|
193
|
+
<div id="footer">
|
194
|
+
Generated on Thu Jun 24 14:16:27 2021 by
|
195
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
196
|
+
0.9.26 (ruby-2.6.6).
|
197
|
+
</div>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
</body>
|
201
|
+
</html>
|