cloudmersive-voice-recognition-api-client 2.0.2 → 2.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 +4 -4
- data/README.md +16 -13
- data/docs/RecognizeApi.md +18 -13
- data/docs/SpeakApi.md +15 -72
- data/docs/SpeechRecognitionResult.md +1 -0
- data/docs/TextToSpeechRequest.md +3 -1
- data/docs/TokenTimestamp.md +12 -0
- data/lib/cloudmersive-voice-recognition-api-client/api/recognize_api.rb +19 -17
- data/lib/cloudmersive-voice-recognition-api-client/api/speak_api.rb +17 -81
- data/lib/cloudmersive-voice-recognition-api-client/configuration.rb +1 -1
- data/lib/cloudmersive-voice-recognition-api-client/models/speech_recognition_result.rb +16 -4
- data/lib/cloudmersive-voice-recognition-api-client/models/text_to_speech_request.rb +29 -9
- data/lib/cloudmersive-voice-recognition-api-client/models/token_timestamp.rb +226 -0
- data/lib/cloudmersive-voice-recognition-api-client/version.rb +1 -1
- data/lib/cloudmersive-voice-recognition-api-client.rb +1 -0
- data/spec/api/recognize_api_spec.rb +7 -5
- data/spec/api/speak_api_spec.rb +6 -19
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/speech_recognition_result_spec.rb +6 -0
- data/spec/models/text_to_speech_request_spec.rb +13 -1
- data/spec/models/token_timestamp_spec.rb +65 -0
- metadata +21 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 405d1f8b1c560ca95a63f43d192353b7ac1ab6d5a767d0e3315bd4860e0e0c64
|
|
4
|
+
data.tar.gz: 0c2e9209da9da2b8115914c7a9a07df738118c2156a1fe158f112e374d3f30f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b407d596fa94ce643b5726b50d531967a7783544134c922e32d3397ed68d6acf85020e81c69e70ff93af77c89408c37ef9dc21486609011ba4ad343d1df5819
|
|
7
|
+
data.tar.gz: 04bf4981020bd2392dad38724ef8729bd85d89a05fc10581c318e19de8e62906c95ba3d7318ea06cb28dd20ad56fb3d75f3bf808ea17f0deae6ad359aa2447bf
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Speech APIs enable you to recognize speech and convert it to text using advanced
|
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
|
8
8
|
|
|
9
9
|
- API version: v1
|
|
10
|
-
- Package version: 2.0
|
|
10
|
+
- Package version: 2.1.0
|
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
@@ -23,15 +23,15 @@ gem build cloudmersive-voice-recognition-api-client.gemspec
|
|
|
23
23
|
Then either install the gem locally:
|
|
24
24
|
|
|
25
25
|
```shell
|
|
26
|
-
gem install ./cloudmersive-voice-recognition-api-client-2.0.
|
|
26
|
+
gem install ./cloudmersive-voice-recognition-api-client-2.1.0.gem
|
|
27
27
|
```
|
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-voice-recognition-api-client-2.0.
|
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-voice-recognition-api-client-2.1.0.gem` to install the development dependencies)
|
|
29
29
|
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
|
31
31
|
|
|
32
32
|
Finally add this to the Gemfile:
|
|
33
33
|
|
|
34
|
-
gem 'cloudmersive-voice-recognition-api-client', '~> 2.0
|
|
34
|
+
gem 'cloudmersive-voice-recognition-api-client', '~> 2.1.0'
|
|
35
35
|
|
|
36
36
|
### Install from Git
|
|
37
37
|
|
|
@@ -64,34 +64,37 @@ end
|
|
|
64
64
|
|
|
65
65
|
api_instance = CloudmersiveVoiceRecognitionApiClient::RecognizeApi.new
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
opts = {
|
|
68
|
+
language_code: '', # String | ISO 639-3 three-letter language code (e.g. eng, spa, fra). Empty for auto-detect.
|
|
69
|
+
recognition_mode: 'Normal', # String | Recognition mode: Fast, Normal (default), or Advanced. Advanced is only available on Private Cloud and Managed Instance deployments.
|
|
70
|
+
speech_file: File.new('/path/to/file.txt') # File |
|
|
71
|
+
}
|
|
69
72
|
|
|
70
73
|
begin
|
|
71
|
-
#Recognize audio input as text using
|
|
72
|
-
result = api_instance.
|
|
74
|
+
#Recognize audio input as text using Advanced AI
|
|
75
|
+
result = api_instance.speech_recognize_file_post(opts)
|
|
73
76
|
p result
|
|
74
77
|
rescue CloudmersiveVoiceRecognitionApiClient::ApiError => e
|
|
75
|
-
puts "Exception when calling RecognizeApi->
|
|
78
|
+
puts "Exception when calling RecognizeApi->speech_recognize_file_post: #{e}"
|
|
76
79
|
end
|
|
77
80
|
|
|
78
81
|
```
|
|
79
82
|
|
|
80
83
|
## Documentation for API Endpoints
|
|
81
84
|
|
|
82
|
-
All URIs are relative to *https://
|
|
85
|
+
All URIs are relative to *https://testapi.cloudmersive.com*
|
|
83
86
|
|
|
84
87
|
Class | Method | HTTP request | Description
|
|
85
88
|
------------ | ------------- | ------------- | -------------
|
|
86
|
-
*CloudmersiveVoiceRecognitionApiClient::RecognizeApi* | [**
|
|
87
|
-
*CloudmersiveVoiceRecognitionApiClient::SpeakApi* | [**
|
|
88
|
-
*CloudmersiveVoiceRecognitionApiClient::SpeakApi* | [**speak_text_to_speech**](docs/SpeakApi.md#speak_text_to_speech) | **POST** /speech/speak/text/voice/basic/audio | Perform text-to-speech on a string
|
|
89
|
+
*CloudmersiveVoiceRecognitionApiClient::RecognizeApi* | [**speech_recognize_file_post**](docs/RecognizeApi.md#speech_recognize_file_post) | **POST** /speech/recognize/file | Recognize audio input as text using Advanced AI
|
|
90
|
+
*CloudmersiveVoiceRecognitionApiClient::SpeakApi* | [**speech_speak_text_voice_basic_audio_post**](docs/SpeakApi.md#speech_speak_text_voice_basic_audio_post) | **POST** /speech/speak/text/voice/basic/audio | Generate audio from text using Advanced AI
|
|
89
91
|
|
|
90
92
|
|
|
91
93
|
## Documentation for Models
|
|
92
94
|
|
|
93
95
|
- [CloudmersiveVoiceRecognitionApiClient::SpeechRecognitionResult](docs/SpeechRecognitionResult.md)
|
|
94
96
|
- [CloudmersiveVoiceRecognitionApiClient::TextToSpeechRequest](docs/TextToSpeechRequest.md)
|
|
97
|
+
- [CloudmersiveVoiceRecognitionApiClient::TokenTimestamp](docs/TokenTimestamp.md)
|
|
95
98
|
|
|
96
99
|
|
|
97
100
|
## Documentation for Authorization
|
data/docs/RecognizeApi.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# CloudmersiveVoiceRecognitionApiClient::RecognizeApi
|
|
2
2
|
|
|
3
|
-
All URIs are relative to *https://
|
|
3
|
+
All URIs are relative to *https://testapi.cloudmersive.com*
|
|
4
4
|
|
|
5
5
|
Method | HTTP request | Description
|
|
6
6
|
------------- | ------------- | -------------
|
|
7
|
-
[**
|
|
7
|
+
[**speech_recognize_file_post**](RecognizeApi.md#speech_recognize_file_post) | **POST** /speech/recognize/file | Recognize audio input as text using Advanced AI
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
# **
|
|
11
|
-
> SpeechRecognitionResult
|
|
10
|
+
# **speech_recognize_file_post**
|
|
11
|
+
> SpeechRecognitionResult speech_recognize_file_post(opts)
|
|
12
12
|
|
|
13
|
-
Recognize audio input as text using
|
|
13
|
+
Recognize audio input as text using Advanced AI
|
|
14
14
|
|
|
15
|
-
Uses advanced
|
|
15
|
+
Uses advanced AI to convert input audio to text. Supports WAV, MP3, M4A, FLAC, OGG, and WMA formats. Consumes 1 API call per second of audio in Fast mode, 5 API calls per second in Normal mode, and 10 API calls per second in Advanced mode.
|
|
16
16
|
|
|
17
17
|
### Example
|
|
18
18
|
```ruby
|
|
@@ -28,15 +28,18 @@ end
|
|
|
28
28
|
|
|
29
29
|
api_instance = CloudmersiveVoiceRecognitionApiClient::RecognizeApi.new
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
opts = {
|
|
32
|
+
language_code: '', # String | ISO 639-3 three-letter language code (e.g. eng, spa, fra). Empty for auto-detect.
|
|
33
|
+
recognition_mode: 'Normal', # String | Recognition mode: Fast, Normal (default), or Advanced. Advanced is only available on Private Cloud and Managed Instance deployments.
|
|
34
|
+
speech_file: File.new('/path/to/file.txt') # File |
|
|
35
|
+
}
|
|
33
36
|
|
|
34
37
|
begin
|
|
35
|
-
#Recognize audio input as text using
|
|
36
|
-
result = api_instance.
|
|
38
|
+
#Recognize audio input as text using Advanced AI
|
|
39
|
+
result = api_instance.speech_recognize_file_post(opts)
|
|
37
40
|
p result
|
|
38
41
|
rescue CloudmersiveVoiceRecognitionApiClient::ApiError => e
|
|
39
|
-
puts "Exception when calling RecognizeApi->
|
|
42
|
+
puts "Exception when calling RecognizeApi->speech_recognize_file_post: #{e}"
|
|
40
43
|
end
|
|
41
44
|
```
|
|
42
45
|
|
|
@@ -44,7 +47,9 @@ end
|
|
|
44
47
|
|
|
45
48
|
Name | Type | Description | Notes
|
|
46
49
|
------------- | ------------- | ------------- | -------------
|
|
47
|
-
**
|
|
50
|
+
**language_code** | **String**| ISO 639-3 three-letter language code (e.g. eng, spa, fra). Empty for auto-detect. | [optional] [default to ]
|
|
51
|
+
**recognition_mode** | **String**| Recognition mode: Fast, Normal (default), or Advanced. Advanced is only available on Private Cloud and Managed Instance deployments. | [optional] [default to Normal]
|
|
52
|
+
**speech_file** | **File**| | [optional]
|
|
48
53
|
|
|
49
54
|
### Return type
|
|
50
55
|
|
|
@@ -57,7 +62,7 @@ Name | Type | Description | Notes
|
|
|
57
62
|
### HTTP request headers
|
|
58
63
|
|
|
59
64
|
- **Content-Type**: multipart/form-data
|
|
60
|
-
- **Accept**:
|
|
65
|
+
- **Accept**: text/plain, application/json, text/json
|
|
61
66
|
|
|
62
67
|
|
|
63
68
|
|
data/docs/SpeakApi.md
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
# CloudmersiveVoiceRecognitionApiClient::SpeakApi
|
|
2
2
|
|
|
3
|
-
All URIs are relative to *https://
|
|
3
|
+
All URIs are relative to *https://testapi.cloudmersive.com*
|
|
4
4
|
|
|
5
5
|
Method | HTTP request | Description
|
|
6
6
|
------------- | ------------- | -------------
|
|
7
|
-
[**
|
|
8
|
-
[**speak_text_to_speech**](SpeakApi.md#speak_text_to_speech) | **POST** /speech/speak/text/voice/basic/audio | Perform text-to-speech on a string
|
|
7
|
+
[**speech_speak_text_voice_basic_audio_post**](SpeakApi.md#speech_speak_text_voice_basic_audio_post) | **POST** /speech/speak/text/voice/basic/audio | Generate audio from text using Advanced AI
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
# **
|
|
12
|
-
>
|
|
10
|
+
# **speech_speak_text_voice_basic_audio_post**
|
|
11
|
+
> String speech_speak_text_voice_basic_audio_post(opts)
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
Generate audio from text using Advanced AI
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
Converts text to speech using advanced AI. Supports English, Spanish, French, Hindi, Italian, Japanese, Portuguese, and Chinese. Specify language with LanguageCode (ISO 639-3, default: eng) and gender with Gender (Male or Female, default: Female). Output format is controlled by the Format field (mp3 or wav, default: mp3). Consumes 1 API call per second of generated audio.
|
|
17
16
|
|
|
18
17
|
### Example
|
|
19
18
|
```ruby
|
|
@@ -29,17 +28,16 @@ end
|
|
|
29
28
|
|
|
30
29
|
api_instance = CloudmersiveVoiceRecognitionApiClient::SpeakApi.new
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
opts = {
|
|
32
|
+
body: CloudmersiveVoiceRecognitionApiClient::TextToSpeechRequest.new # TextToSpeechRequest | String input request
|
|
33
|
+
}
|
|
36
34
|
|
|
37
35
|
begin
|
|
38
|
-
#
|
|
39
|
-
result = api_instance.
|
|
36
|
+
#Generate audio from text using Advanced AI
|
|
37
|
+
result = api_instance.speech_speak_text_voice_basic_audio_post(opts)
|
|
40
38
|
p result
|
|
41
39
|
rescue CloudmersiveVoiceRecognitionApiClient::ApiError => e
|
|
42
|
-
puts "Exception when calling SpeakApi->
|
|
40
|
+
puts "Exception when calling SpeakApi->speech_speak_text_voice_basic_audio_post: #{e}"
|
|
43
41
|
end
|
|
44
42
|
```
|
|
45
43
|
|
|
@@ -47,12 +45,11 @@ end
|
|
|
47
45
|
|
|
48
46
|
Name | Type | Description | Notes
|
|
49
47
|
------------- | ------------- | ------------- | -------------
|
|
50
|
-
**
|
|
51
|
-
**text** | **String**| The text you would like to conver to speech. Be sure to surround with quotes, e.g. \"The quick brown fox jumps over the lazy dog.\" |
|
|
48
|
+
**body** | [**TextToSpeechRequest**](TextToSpeechRequest.md)| String input request | [optional]
|
|
52
49
|
|
|
53
50
|
### Return type
|
|
54
51
|
|
|
55
|
-
**
|
|
52
|
+
**String**
|
|
56
53
|
|
|
57
54
|
### Authorization
|
|
58
55
|
|
|
@@ -60,62 +57,8 @@ Name | Type | Description | Notes
|
|
|
60
57
|
|
|
61
58
|
### HTTP request headers
|
|
62
59
|
|
|
63
|
-
- **Content-Type**: application/json, text/json, application
|
|
60
|
+
- **Content-Type**: application/json, text/json, application/*+json
|
|
64
61
|
- **Accept**: application/octet-stream
|
|
65
62
|
|
|
66
63
|
|
|
67
64
|
|
|
68
|
-
# **speak_text_to_speech**
|
|
69
|
-
> Object speak_text_to_speech(req_config)
|
|
70
|
-
|
|
71
|
-
Perform text-to-speech on a string
|
|
72
|
-
|
|
73
|
-
Takes as input a string and a file format (mp3 or wav) and outputs a wave form in the appropriate format.
|
|
74
|
-
|
|
75
|
-
### Example
|
|
76
|
-
```ruby
|
|
77
|
-
# load the gem
|
|
78
|
-
require 'cloudmersive-voice-recognition-api-client'
|
|
79
|
-
# setup authorization
|
|
80
|
-
CloudmersiveVoiceRecognitionApiClient.configure do |config|
|
|
81
|
-
# Configure API key authorization: Apikey
|
|
82
|
-
config.api_key['Apikey'] = 'YOUR API KEY'
|
|
83
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
84
|
-
#config.api_key_prefix['Apikey'] = 'Bearer'
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
api_instance = CloudmersiveVoiceRecognitionApiClient::SpeakApi.new
|
|
88
|
-
|
|
89
|
-
req_config = CloudmersiveVoiceRecognitionApiClient::TextToSpeechRequest.new # TextToSpeechRequest | String input request
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
begin
|
|
93
|
-
#Perform text-to-speech on a string
|
|
94
|
-
result = api_instance.speak_text_to_speech(req_config)
|
|
95
|
-
p result
|
|
96
|
-
rescue CloudmersiveVoiceRecognitionApiClient::ApiError => e
|
|
97
|
-
puts "Exception when calling SpeakApi->speak_text_to_speech: #{e}"
|
|
98
|
-
end
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Parameters
|
|
102
|
-
|
|
103
|
-
Name | Type | Description | Notes
|
|
104
|
-
------------- | ------------- | ------------- | -------------
|
|
105
|
-
**req_config** | [**TextToSpeechRequest**](TextToSpeechRequest.md)| String input request |
|
|
106
|
-
|
|
107
|
-
### Return type
|
|
108
|
-
|
|
109
|
-
**Object**
|
|
110
|
-
|
|
111
|
-
### Authorization
|
|
112
|
-
|
|
113
|
-
[Apikey](../README.md#Apikey)
|
|
114
|
-
|
|
115
|
-
### HTTP request headers
|
|
116
|
-
|
|
117
|
-
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
|
118
|
-
- **Accept**: application/json, text/json, application/xml, text/xml
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
|
6
6
|
**text_result** | **String** | Recognition result in text format | [optional]
|
|
7
|
+
**timestamps** | [**Array<TokenTimestamp>**](TokenTimestamp.md) | Token-level timestamps with character offsets into TextResult | [optional]
|
|
7
8
|
|
|
8
9
|
|
data/docs/TextToSpeechRequest.md
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
## Properties
|
|
4
4
|
Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
|
6
|
-
**format** | **String** | File format for output audio file: wav or mp3, default is mp3 | [optional]
|
|
7
6
|
**text** | **String** | Text to be converted to speech | [optional]
|
|
7
|
+
**format** | **String** | File format for output audio file: wav or mp3, default is mp3 | [optional]
|
|
8
|
+
**language_code** | **String** | ISO 639-3 three-letter language code (e.g. eng, spa, fra, hin, ita, jpn, por, zho). Default is eng (English). | [optional]
|
|
9
|
+
**gender** | **String** | Voice gender: Male or Female. Default is Female. Note: Male is not available for French and Chinese. | [optional]
|
|
8
10
|
|
|
9
11
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# CloudmersiveVoiceRecognitionApiClient::TokenTimestamp
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**token** | **String** | The token text (word or subword) | [optional]
|
|
7
|
+
**character_offset_start** | **Integer** | Start character offset (0-based) in TextResult | [optional]
|
|
8
|
+
**character_offset_end** | **Integer** | End character offset (exclusive) in TextResult | [optional]
|
|
9
|
+
**start_time_ms** | **Integer** | Start time of this token in the audio, in milliseconds | [optional]
|
|
10
|
+
**end_time_ms** | **Integer** | End time of this token in the audio, in milliseconds | [optional]
|
|
11
|
+
|
|
12
|
+
|
|
@@ -19,28 +19,28 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
|
-
# Recognize audio input as text using
|
|
23
|
-
# Uses advanced
|
|
24
|
-
# @param speech_file Speech file to perform the operation on. Common file formats such as WAV, MP3 are supported.
|
|
22
|
+
# Recognize audio input as text using Advanced AI
|
|
23
|
+
# Uses advanced AI to convert input audio to text. Supports WAV, MP3, M4A, FLAC, OGG, and WMA formats. Consumes 1 API call per second of audio in Fast mode, 5 API calls per second in Normal mode, and 10 API calls per second in Advanced mode.
|
|
25
24
|
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @option opts [String] :language_code ISO 639-3 three-letter language code (e.g. eng, spa, fra). Empty for auto-detect. (default to )
|
|
26
|
+
# @option opts [String] :recognition_mode Recognition mode: Fast, Normal (default), or Advanced. Advanced is only available on Private Cloud and Managed Instance deployments. (default to Normal)
|
|
27
|
+
# @option opts [File] :speech_file
|
|
26
28
|
# @return [SpeechRecognitionResult]
|
|
27
|
-
def
|
|
28
|
-
data, _status_code, _headers =
|
|
29
|
+
def speech_recognize_file_post(opts = {})
|
|
30
|
+
data, _status_code, _headers = speech_recognize_file_post_with_http_info(opts)
|
|
29
31
|
data
|
|
30
32
|
end
|
|
31
33
|
|
|
32
|
-
# Recognize audio input as text using
|
|
33
|
-
# Uses advanced
|
|
34
|
-
# @param speech_file Speech file to perform the operation on. Common file formats such as WAV, MP3 are supported.
|
|
34
|
+
# Recognize audio input as text using Advanced AI
|
|
35
|
+
# Uses advanced AI to convert input audio to text. Supports WAV, MP3, M4A, FLAC, OGG, and WMA formats. Consumes 1 API call per second of audio in Fast mode, 5 API calls per second in Normal mode, and 10 API calls per second in Advanced mode.
|
|
35
36
|
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :language_code ISO 639-3 three-letter language code (e.g. eng, spa, fra). Empty for auto-detect.
|
|
38
|
+
# @option opts [String] :recognition_mode Recognition mode: Fast, Normal (default), or Advanced. Advanced is only available on Private Cloud and Managed Instance deployments.
|
|
39
|
+
# @option opts [File] :speech_file
|
|
36
40
|
# @return [Array<(SpeechRecognitionResult, Fixnum, Hash)>] SpeechRecognitionResult data, response status code and response headers
|
|
37
|
-
def
|
|
41
|
+
def speech_recognize_file_post_with_http_info(opts = {})
|
|
38
42
|
if @api_client.config.debugging
|
|
39
|
-
@api_client.config.logger.debug 'Calling API: RecognizeApi.
|
|
40
|
-
end
|
|
41
|
-
# verify the required parameter 'speech_file' is set
|
|
42
|
-
if @api_client.config.client_side_validation && speech_file.nil?
|
|
43
|
-
fail ArgumentError, "Missing the required parameter 'speech_file' when calling RecognizeApi.recognize_file"
|
|
43
|
+
@api_client.config.logger.debug 'Calling API: RecognizeApi.speech_recognize_file_post ...'
|
|
44
44
|
end
|
|
45
45
|
# resource path
|
|
46
46
|
local_var_path = '/speech/recognize/file'
|
|
@@ -51,13 +51,15 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
51
51
|
# header parameters
|
|
52
52
|
header_params = {}
|
|
53
53
|
# HTTP header 'Accept' (if needed)
|
|
54
|
-
header_params['Accept'] = @api_client.select_header_accept(['
|
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
55
55
|
# HTTP header 'Content-Type'
|
|
56
56
|
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
57
|
+
header_params[:'languageCode'] = opts[:'language_code'] if !opts[:'language_code'].nil?
|
|
58
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
57
59
|
|
|
58
60
|
# form parameters
|
|
59
61
|
form_params = {}
|
|
60
|
-
form_params['speechFile'] = speech_file
|
|
62
|
+
form_params['speechFile'] = opts[:'speech_file'] if !opts[:'speech_file'].nil?
|
|
61
63
|
|
|
62
64
|
# http body (model)
|
|
63
65
|
post_body = nil
|
|
@@ -70,7 +72,7 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
70
72
|
:auth_names => auth_names,
|
|
71
73
|
:return_type => 'SpeechRecognitionResult')
|
|
72
74
|
if @api_client.config.debugging
|
|
73
|
-
@api_client.config.logger.debug "API called: RecognizeApi#
|
|
75
|
+
@api_client.config.logger.debug "API called: RecognizeApi#speech_recognize_file_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
74
76
|
end
|
|
75
77
|
return data, status_code, headers
|
|
76
78
|
end
|
|
@@ -19,88 +19,24 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
# @param format File format to generate response in; possible values are \"mp3\" or \"wav\"
|
|
25
|
-
# @param text The text you would like to conver to speech. Be sure to surround with quotes, e.g. \"The quick brown fox jumps over the lazy dog.\"
|
|
22
|
+
# Generate audio from text using Advanced AI
|
|
23
|
+
# Converts text to speech using advanced AI. Supports English, Spanish, French, Hindi, Italian, Japanese, Portuguese, and Chinese. Specify language with LanguageCode (ISO 639-3, default: eng) and gender with Gender (Male or Female, default: Female). Output format is controlled by the Format field (mp3 or wav, default: mp3). Consumes 1 API call per second of generated audio.
|
|
26
24
|
# @param [Hash] opts the optional parameters
|
|
27
|
-
# @
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
# @option opts [TextToSpeechRequest] :body String input request
|
|
26
|
+
# @return [String]
|
|
27
|
+
def speech_speak_text_voice_basic_audio_post(opts = {})
|
|
28
|
+
data, _status_code, _headers = speech_speak_text_voice_basic_audio_post_with_http_info(opts)
|
|
30
29
|
data
|
|
31
30
|
end
|
|
32
31
|
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
# @param format File format to generate response in; possible values are \"mp3\" or \"wav\"
|
|
36
|
-
# @param text The text you would like to conver to speech. Be sure to surround with quotes, e.g. \"The quick brown fox jumps over the lazy dog.\"
|
|
32
|
+
# Generate audio from text using Advanced AI
|
|
33
|
+
# Converts text to speech using advanced AI. Supports English, Spanish, French, Hindi, Italian, Japanese, Portuguese, and Chinese. Specify language with LanguageCode (ISO 639-3, default: eng) and gender with Gender (Male or Female, default: Female). Output format is controlled by the Format field (mp3 or wav, default: mp3). Consumes 1 API call per second of generated audio.
|
|
37
34
|
# @param [Hash] opts the optional parameters
|
|
38
|
-
# @
|
|
39
|
-
|
|
35
|
+
# @option opts [TextToSpeechRequest] :body String input request
|
|
36
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
|
37
|
+
def speech_speak_text_voice_basic_audio_post_with_http_info(opts = {})
|
|
40
38
|
if @api_client.config.debugging
|
|
41
|
-
@api_client.config.logger.debug 'Calling API: SpeakApi.
|
|
42
|
-
end
|
|
43
|
-
# verify the required parameter 'format' is set
|
|
44
|
-
if @api_client.config.client_side_validation && format.nil?
|
|
45
|
-
fail ArgumentError, "Missing the required parameter 'format' when calling SpeakApi.speak_post"
|
|
46
|
-
end
|
|
47
|
-
# verify the required parameter 'text' is set
|
|
48
|
-
if @api_client.config.client_side_validation && text.nil?
|
|
49
|
-
fail ArgumentError, "Missing the required parameter 'text' when calling SpeakApi.speak_post"
|
|
50
|
-
end
|
|
51
|
-
# resource path
|
|
52
|
-
local_var_path = '/speech/speak/text/basicVoice/{format}'.sub('{' + 'format' + '}', format.to_s)
|
|
53
|
-
|
|
54
|
-
# query parameters
|
|
55
|
-
query_params = {}
|
|
56
|
-
|
|
57
|
-
# header parameters
|
|
58
|
-
header_params = {}
|
|
59
|
-
# HTTP header 'Accept' (if needed)
|
|
60
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
|
61
|
-
# HTTP header 'Content-Type'
|
|
62
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
|
63
|
-
|
|
64
|
-
# form parameters
|
|
65
|
-
form_params = {}
|
|
66
|
-
|
|
67
|
-
# http body (model)
|
|
68
|
-
post_body = @api_client.object_to_http_body(text)
|
|
69
|
-
auth_names = ['Apikey']
|
|
70
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
71
|
-
:header_params => header_params,
|
|
72
|
-
:query_params => query_params,
|
|
73
|
-
:form_params => form_params,
|
|
74
|
-
:body => post_body,
|
|
75
|
-
:auth_names => auth_names,
|
|
76
|
-
:return_type => 'Object')
|
|
77
|
-
if @api_client.config.debugging
|
|
78
|
-
@api_client.config.logger.debug "API called: SpeakApi#speak_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
79
|
-
end
|
|
80
|
-
return data, status_code, headers
|
|
81
|
-
end
|
|
82
|
-
# Perform text-to-speech on a string
|
|
83
|
-
# Takes as input a string and a file format (mp3 or wav) and outputs a wave form in the appropriate format.
|
|
84
|
-
# @param req_config String input request
|
|
85
|
-
# @param [Hash] opts the optional parameters
|
|
86
|
-
# @return [Object]
|
|
87
|
-
def speak_text_to_speech(req_config, opts = {})
|
|
88
|
-
data, _status_code, _headers = speak_text_to_speech_with_http_info(req_config, opts)
|
|
89
|
-
data
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
# Perform text-to-speech on a string
|
|
93
|
-
# Takes as input a string and a file format (mp3 or wav) and outputs a wave form in the appropriate format.
|
|
94
|
-
# @param req_config String input request
|
|
95
|
-
# @param [Hash] opts the optional parameters
|
|
96
|
-
# @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
|
|
97
|
-
def speak_text_to_speech_with_http_info(req_config, opts = {})
|
|
98
|
-
if @api_client.config.debugging
|
|
99
|
-
@api_client.config.logger.debug 'Calling API: SpeakApi.speak_text_to_speech ...'
|
|
100
|
-
end
|
|
101
|
-
# verify the required parameter 'req_config' is set
|
|
102
|
-
if @api_client.config.client_side_validation && req_config.nil?
|
|
103
|
-
fail ArgumentError, "Missing the required parameter 'req_config' when calling SpeakApi.speak_text_to_speech"
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: SpeakApi.speech_speak_text_voice_basic_audio_post ...'
|
|
104
40
|
end
|
|
105
41
|
# resource path
|
|
106
42
|
local_var_path = '/speech/speak/text/voice/basic/audio'
|
|
@@ -111,15 +47,15 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
111
47
|
# header parameters
|
|
112
48
|
header_params = {}
|
|
113
49
|
# HTTP header 'Accept' (if needed)
|
|
114
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/
|
|
50
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
|
115
51
|
# HTTP header 'Content-Type'
|
|
116
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application
|
|
52
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
|
|
117
53
|
|
|
118
54
|
# form parameters
|
|
119
55
|
form_params = {}
|
|
120
56
|
|
|
121
57
|
# http body (model)
|
|
122
|
-
post_body = @api_client.object_to_http_body(
|
|
58
|
+
post_body = @api_client.object_to_http_body(opts[:'body'])
|
|
123
59
|
auth_names = ['Apikey']
|
|
124
60
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
125
61
|
:header_params => header_params,
|
|
@@ -127,9 +63,9 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
127
63
|
:form_params => form_params,
|
|
128
64
|
:body => post_body,
|
|
129
65
|
:auth_names => auth_names,
|
|
130
|
-
:return_type => '
|
|
66
|
+
:return_type => 'String')
|
|
131
67
|
if @api_client.config.debugging
|
|
132
|
-
@api_client.config.logger.debug "API called: SpeakApi#
|
|
68
|
+
@api_client.config.logger.debug "API called: SpeakApi#speech_speak_text_voice_basic_audio_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
133
69
|
end
|
|
134
70
|
return data, status_code, headers
|
|
135
71
|
end
|
|
@@ -18,17 +18,22 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
18
18
|
# Recognition result in text format
|
|
19
19
|
attr_accessor :text_result
|
|
20
20
|
|
|
21
|
+
# Token-level timestamps with character offsets into TextResult
|
|
22
|
+
attr_accessor :timestamps
|
|
23
|
+
|
|
21
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
25
|
def self.attribute_map
|
|
23
26
|
{
|
|
24
|
-
:'text_result' => :'TextResult'
|
|
27
|
+
:'text_result' => :'TextResult',
|
|
28
|
+
:'timestamps' => :'Timestamps'
|
|
25
29
|
}
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
# Attribute type mapping.
|
|
29
33
|
def self.swagger_types
|
|
30
34
|
{
|
|
31
|
-
:'text_result' => :'String'
|
|
35
|
+
:'text_result' => :'String',
|
|
36
|
+
:'timestamps' => :'Array<TokenTimestamp>'
|
|
32
37
|
}
|
|
33
38
|
end
|
|
34
39
|
|
|
@@ -43,6 +48,12 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
43
48
|
if attributes.has_key?(:'TextResult')
|
|
44
49
|
self.text_result = attributes[:'TextResult']
|
|
45
50
|
end
|
|
51
|
+
|
|
52
|
+
if attributes.has_key?(:'Timestamps')
|
|
53
|
+
if (value = attributes[:'Timestamps']).is_a?(Array)
|
|
54
|
+
self.timestamps = value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
46
57
|
end
|
|
47
58
|
|
|
48
59
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -63,7 +74,8 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
63
74
|
def ==(o)
|
|
64
75
|
return true if self.equal?(o)
|
|
65
76
|
self.class == o.class &&
|
|
66
|
-
text_result == o.text_result
|
|
77
|
+
text_result == o.text_result &&
|
|
78
|
+
timestamps == o.timestamps
|
|
67
79
|
end
|
|
68
80
|
|
|
69
81
|
# @see the `==` method
|
|
@@ -75,7 +87,7 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
75
87
|
# Calculates hash code according to all attributes.
|
|
76
88
|
# @return [Fixnum] Hash code
|
|
77
89
|
def hash
|
|
78
|
-
[text_result].hash
|
|
90
|
+
[text_result, timestamps].hash
|
|
79
91
|
end
|
|
80
92
|
|
|
81
93
|
# Builds the object from hash
|
|
@@ -13,27 +13,37 @@ Swagger Codegen version: 2.4.14
|
|
|
13
13
|
require 'date'
|
|
14
14
|
|
|
15
15
|
module CloudmersiveVoiceRecognitionApiClient
|
|
16
|
-
# Input to a
|
|
16
|
+
# Input to a text-to-speech request
|
|
17
17
|
class TextToSpeechRequest
|
|
18
|
+
# Text to be converted to speech
|
|
19
|
+
attr_accessor :text
|
|
20
|
+
|
|
18
21
|
# File format for output audio file: wav or mp3, default is mp3
|
|
19
22
|
attr_accessor :format
|
|
20
23
|
|
|
21
|
-
#
|
|
22
|
-
attr_accessor :
|
|
24
|
+
# ISO 639-3 three-letter language code (e.g. eng, spa, fra, hin, ita, jpn, por, zho). Default is eng (English).
|
|
25
|
+
attr_accessor :language_code
|
|
26
|
+
|
|
27
|
+
# Voice gender: Male or Female. Default is Female. Note: Male is not available for French and Chinese.
|
|
28
|
+
attr_accessor :gender
|
|
23
29
|
|
|
24
30
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
31
|
def self.attribute_map
|
|
26
32
|
{
|
|
33
|
+
:'text' => :'Text',
|
|
27
34
|
:'format' => :'Format',
|
|
28
|
-
:'
|
|
35
|
+
:'language_code' => :'LanguageCode',
|
|
36
|
+
:'gender' => :'Gender'
|
|
29
37
|
}
|
|
30
38
|
end
|
|
31
39
|
|
|
32
40
|
# Attribute type mapping.
|
|
33
41
|
def self.swagger_types
|
|
34
42
|
{
|
|
43
|
+
:'text' => :'String',
|
|
35
44
|
:'format' => :'String',
|
|
36
|
-
:'
|
|
45
|
+
:'language_code' => :'String',
|
|
46
|
+
:'gender' => :'String'
|
|
37
47
|
}
|
|
38
48
|
end
|
|
39
49
|
|
|
@@ -45,12 +55,20 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
45
55
|
# convert string to symbol for hash key
|
|
46
56
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
47
57
|
|
|
58
|
+
if attributes.has_key?(:'Text')
|
|
59
|
+
self.text = attributes[:'Text']
|
|
60
|
+
end
|
|
61
|
+
|
|
48
62
|
if attributes.has_key?(:'Format')
|
|
49
63
|
self.format = attributes[:'Format']
|
|
50
64
|
end
|
|
51
65
|
|
|
52
|
-
if attributes.has_key?(:'
|
|
53
|
-
self.
|
|
66
|
+
if attributes.has_key?(:'LanguageCode')
|
|
67
|
+
self.language_code = attributes[:'LanguageCode']
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if attributes.has_key?(:'Gender')
|
|
71
|
+
self.gender = attributes[:'Gender']
|
|
54
72
|
end
|
|
55
73
|
end
|
|
56
74
|
|
|
@@ -72,8 +90,10 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
72
90
|
def ==(o)
|
|
73
91
|
return true if self.equal?(o)
|
|
74
92
|
self.class == o.class &&
|
|
93
|
+
text == o.text &&
|
|
75
94
|
format == o.format &&
|
|
76
|
-
|
|
95
|
+
language_code == o.language_code &&
|
|
96
|
+
gender == o.gender
|
|
77
97
|
end
|
|
78
98
|
|
|
79
99
|
# @see the `==` method
|
|
@@ -85,7 +105,7 @@ module CloudmersiveVoiceRecognitionApiClient
|
|
|
85
105
|
# Calculates hash code according to all attributes.
|
|
86
106
|
# @return [Fixnum] Hash code
|
|
87
107
|
def hash
|
|
88
|
-
[format,
|
|
108
|
+
[text, format, language_code, gender].hash
|
|
89
109
|
end
|
|
90
110
|
|
|
91
111
|
# Builds the object from hash
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#speechapi
|
|
3
|
+
|
|
4
|
+
#Speech APIs enable you to recognize speech and convert it to text using advanced machine learning, and also to convert text to speech.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.14
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module CloudmersiveVoiceRecognitionApiClient
|
|
16
|
+
# A single token with its time range and position in the output text
|
|
17
|
+
class TokenTimestamp
|
|
18
|
+
# The token text (word or subword)
|
|
19
|
+
attr_accessor :token
|
|
20
|
+
|
|
21
|
+
# Start character offset (0-based) in TextResult
|
|
22
|
+
attr_accessor :character_offset_start
|
|
23
|
+
|
|
24
|
+
# End character offset (exclusive) in TextResult
|
|
25
|
+
attr_accessor :character_offset_end
|
|
26
|
+
|
|
27
|
+
# Start time of this token in the audio, in milliseconds
|
|
28
|
+
attr_accessor :start_time_ms
|
|
29
|
+
|
|
30
|
+
# End time of this token in the audio, in milliseconds
|
|
31
|
+
attr_accessor :end_time_ms
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'token' => :'Token',
|
|
37
|
+
:'character_offset_start' => :'CharacterOffsetStart',
|
|
38
|
+
:'character_offset_end' => :'CharacterOffsetEnd',
|
|
39
|
+
:'start_time_ms' => :'StartTimeMs',
|
|
40
|
+
:'end_time_ms' => :'EndTimeMs'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Attribute type mapping.
|
|
45
|
+
def self.swagger_types
|
|
46
|
+
{
|
|
47
|
+
:'token' => :'String',
|
|
48
|
+
:'character_offset_start' => :'Integer',
|
|
49
|
+
:'character_offset_end' => :'Integer',
|
|
50
|
+
:'start_time_ms' => :'Integer',
|
|
51
|
+
:'end_time_ms' => :'Integer'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Initializes the object
|
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
57
|
+
def initialize(attributes = {})
|
|
58
|
+
return unless attributes.is_a?(Hash)
|
|
59
|
+
|
|
60
|
+
# convert string to symbol for hash key
|
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
62
|
+
|
|
63
|
+
if attributes.has_key?(:'Token')
|
|
64
|
+
self.token = attributes[:'Token']
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if attributes.has_key?(:'CharacterOffsetStart')
|
|
68
|
+
self.character_offset_start = attributes[:'CharacterOffsetStart']
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if attributes.has_key?(:'CharacterOffsetEnd')
|
|
72
|
+
self.character_offset_end = attributes[:'CharacterOffsetEnd']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if attributes.has_key?(:'StartTimeMs')
|
|
76
|
+
self.start_time_ms = attributes[:'StartTimeMs']
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.has_key?(:'EndTimeMs')
|
|
80
|
+
self.end_time_ms = attributes[:'EndTimeMs']
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
85
|
+
# @return Array for valid properties with the reasons
|
|
86
|
+
def list_invalid_properties
|
|
87
|
+
invalid_properties = Array.new
|
|
88
|
+
invalid_properties
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Check to see if the all the properties in the model are valid
|
|
92
|
+
# @return true if the model is valid
|
|
93
|
+
def valid?
|
|
94
|
+
true
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Checks equality by comparing each attribute.
|
|
98
|
+
# @param [Object] Object to be compared
|
|
99
|
+
def ==(o)
|
|
100
|
+
return true if self.equal?(o)
|
|
101
|
+
self.class == o.class &&
|
|
102
|
+
token == o.token &&
|
|
103
|
+
character_offset_start == o.character_offset_start &&
|
|
104
|
+
character_offset_end == o.character_offset_end &&
|
|
105
|
+
start_time_ms == o.start_time_ms &&
|
|
106
|
+
end_time_ms == o.end_time_ms
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# @see the `==` method
|
|
110
|
+
# @param [Object] Object to be compared
|
|
111
|
+
def eql?(o)
|
|
112
|
+
self == o
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Calculates hash code according to all attributes.
|
|
116
|
+
# @return [Fixnum] Hash code
|
|
117
|
+
def hash
|
|
118
|
+
[token, character_offset_start, character_offset_end, start_time_ms, end_time_ms].hash
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Builds the object from hash
|
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
123
|
+
# @return [Object] Returns the model itself
|
|
124
|
+
def build_from_hash(attributes)
|
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
|
126
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
127
|
+
if type =~ /\AArray<(.*)>/i
|
|
128
|
+
# check to ensure the input is an array given that the attribute
|
|
129
|
+
# is documented as an array but the input is not
|
|
130
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
131
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
132
|
+
end
|
|
133
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
134
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
135
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
self
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Deserializes the data based on type
|
|
142
|
+
# @param string type Data type
|
|
143
|
+
# @param string value Value to be deserialized
|
|
144
|
+
# @return [Object] Deserialized data
|
|
145
|
+
def _deserialize(type, value)
|
|
146
|
+
case type.to_sym
|
|
147
|
+
when :DateTime
|
|
148
|
+
DateTime.parse(value)
|
|
149
|
+
when :Date
|
|
150
|
+
Date.parse(value)
|
|
151
|
+
when :String
|
|
152
|
+
value.to_s
|
|
153
|
+
when :Integer
|
|
154
|
+
value.to_i
|
|
155
|
+
when :Float
|
|
156
|
+
value.to_f
|
|
157
|
+
when :BOOLEAN
|
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
159
|
+
true
|
|
160
|
+
else
|
|
161
|
+
false
|
|
162
|
+
end
|
|
163
|
+
when :Object
|
|
164
|
+
# generic object (usually a Hash), return directly
|
|
165
|
+
value
|
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
|
172
|
+
{}.tap do |hash|
|
|
173
|
+
value.each do |k, v|
|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
else # model
|
|
178
|
+
temp_model = CloudmersiveVoiceRecognitionApiClient.const_get(type).new
|
|
179
|
+
temp_model.build_from_hash(value)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Returns the string representation of the object
|
|
184
|
+
# @return [String] String presentation of the object
|
|
185
|
+
def to_s
|
|
186
|
+
to_hash.to_s
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
|
191
|
+
def to_body
|
|
192
|
+
to_hash
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Returns the object in the form of hash
|
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
|
197
|
+
def to_hash
|
|
198
|
+
hash = {}
|
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
200
|
+
value = self.send(attr)
|
|
201
|
+
next if value.nil?
|
|
202
|
+
hash[param] = _to_hash(value)
|
|
203
|
+
end
|
|
204
|
+
hash
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Outputs non-array value in the form of hash
|
|
208
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
209
|
+
# @param [Object] value Any valid value
|
|
210
|
+
# @return [Hash] Returns the value in the form of hash
|
|
211
|
+
def _to_hash(value)
|
|
212
|
+
if value.is_a?(Array)
|
|
213
|
+
value.compact.map { |v| _to_hash(v) }
|
|
214
|
+
elsif value.is_a?(Hash)
|
|
215
|
+
{}.tap do |hash|
|
|
216
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
217
|
+
end
|
|
218
|
+
elsif value.respond_to? :to_hash
|
|
219
|
+
value.to_hash
|
|
220
|
+
else
|
|
221
|
+
value
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
end
|
|
226
|
+
end
|
|
@@ -19,6 +19,7 @@ require 'cloudmersive-voice-recognition-api-client/configuration'
|
|
|
19
19
|
# Models
|
|
20
20
|
require 'cloudmersive-voice-recognition-api-client/models/speech_recognition_result'
|
|
21
21
|
require 'cloudmersive-voice-recognition-api-client/models/text_to_speech_request'
|
|
22
|
+
require 'cloudmersive-voice-recognition-api-client/models/token_timestamp'
|
|
22
23
|
|
|
23
24
|
# APIs
|
|
24
25
|
require 'cloudmersive-voice-recognition-api-client/api/recognize_api'
|
|
@@ -32,13 +32,15 @@ describe 'RecognizeApi' do
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# unit tests for
|
|
36
|
-
# Recognize audio input as text using
|
|
37
|
-
# Uses advanced
|
|
38
|
-
# @param speech_file Speech file to perform the operation on. Common file formats such as WAV, MP3 are supported.
|
|
35
|
+
# unit tests for speech_recognize_file_post
|
|
36
|
+
# Recognize audio input as text using Advanced AI
|
|
37
|
+
# Uses advanced AI to convert input audio to text. Supports WAV, MP3, M4A, FLAC, OGG, and WMA formats. Consumes 1 API call per second of audio in Fast mode, 5 API calls per second in Normal mode, and 10 API calls per second in Advanced mode.
|
|
39
38
|
# @param [Hash] opts the optional parameters
|
|
39
|
+
# @option opts [String] :language_code ISO 639-3 three-letter language code (e.g. eng, spa, fra). Empty for auto-detect.
|
|
40
|
+
# @option opts [String] :recognition_mode Recognition mode: Fast, Normal (default), or Advanced. Advanced is only available on Private Cloud and Managed Instance deployments.
|
|
41
|
+
# @option opts [File] :speech_file
|
|
40
42
|
# @return [SpeechRecognitionResult]
|
|
41
|
-
describe '
|
|
43
|
+
describe 'speech_recognize_file_post test' do
|
|
42
44
|
it 'should work' do
|
|
43
45
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
46
|
end
|
data/spec/api/speak_api_spec.rb
CHANGED
|
@@ -32,26 +32,13 @@ describe 'SpeakApi' do
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# unit tests for
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
# @param format File format to generate response in; possible values are \"mp3\" or \"wav\"
|
|
39
|
-
# @param text The text you would like to conver to speech. Be sure to surround with quotes, e.g. \"The quick brown fox jumps over the lazy dog.\"
|
|
35
|
+
# unit tests for speech_speak_text_voice_basic_audio_post
|
|
36
|
+
# Generate audio from text using Advanced AI
|
|
37
|
+
# Converts text to speech using advanced AI. Supports English, Spanish, French, Hindi, Italian, Japanese, Portuguese, and Chinese. Specify language with LanguageCode (ISO 639-3, default: eng) and gender with Gender (Male or Female, default: Female). Output format is controlled by the Format field (mp3 or wav, default: mp3). Consumes 1 API call per second of generated audio.
|
|
40
38
|
# @param [Hash] opts the optional parameters
|
|
41
|
-
# @
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# unit tests for speak_text_to_speech
|
|
49
|
-
# Perform text-to-speech on a string
|
|
50
|
-
# Takes as input a string and a file format (mp3 or wav) and outputs a wave form in the appropriate format.
|
|
51
|
-
# @param req_config String input request
|
|
52
|
-
# @param [Hash] opts the optional parameters
|
|
53
|
-
# @return [Object]
|
|
54
|
-
describe 'speak_text_to_speech test' do
|
|
39
|
+
# @option opts [TextToSpeechRequest] :body String input request
|
|
40
|
+
# @return [String]
|
|
41
|
+
describe 'speech_speak_text_voice_basic_audio_post test' do
|
|
55
42
|
it 'should work' do
|
|
56
43
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
57
44
|
end
|
data/spec/configuration_spec.rb
CHANGED
|
@@ -18,7 +18,7 @@ describe CloudmersiveVoiceRecognitionApiClient::Configuration do
|
|
|
18
18
|
before(:each) do
|
|
19
19
|
# uncomment below to setup host and base_path
|
|
20
20
|
# require 'URI'
|
|
21
|
-
# uri = URI.parse("https://
|
|
21
|
+
# uri = URI.parse("https://testapi.cloudmersive.com")
|
|
22
22
|
# CloudmersiveVoiceRecognitionApiClient.configure do |c|
|
|
23
23
|
# c.host = uri.host
|
|
24
24
|
# c.base_path = uri.path
|
|
@@ -28,14 +28,14 @@ describe CloudmersiveVoiceRecognitionApiClient::Configuration do
|
|
|
28
28
|
describe '#base_url' do
|
|
29
29
|
it 'should have the default value' do
|
|
30
30
|
# uncomment below to test default value of the base path
|
|
31
|
-
# expect(config.base_url).to eq("https://
|
|
31
|
+
# expect(config.base_url).to eq("https://testapi.cloudmersive.com")
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it 'should remove trailing slashes' do
|
|
35
35
|
[nil, '', '/', '//'].each do |base_path|
|
|
36
36
|
config.base_path = base_path
|
|
37
37
|
# uncomment below to test trailing slashes
|
|
38
|
-
# expect(config.base_url).to eq("https://
|
|
38
|
+
# expect(config.base_url).to eq("https://testapi.cloudmersive.com")
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -32,13 +32,25 @@ describe 'TextToSpeechRequest' do
|
|
|
32
32
|
expect(@instance).to be_instance_of(CloudmersiveVoiceRecognitionApiClient::TextToSpeechRequest)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
+
describe 'test attribute "text"' do
|
|
36
|
+
it 'should work' do
|
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
35
41
|
describe 'test attribute "format"' do
|
|
36
42
|
it 'should work' do
|
|
37
43
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
44
|
end
|
|
39
45
|
end
|
|
40
46
|
|
|
41
|
-
describe 'test attribute "
|
|
47
|
+
describe 'test attribute "language_code"' do
|
|
48
|
+
it 'should work' do
|
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe 'test attribute "gender"' do
|
|
42
54
|
it 'should work' do
|
|
43
55
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
56
|
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#speechapi
|
|
3
|
+
|
|
4
|
+
#Speech APIs enable you to recognize speech and convert it to text using advanced machine learning, and also to convert text to speech.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.14
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'date'
|
|
16
|
+
|
|
17
|
+
# Unit tests for CloudmersiveVoiceRecognitionApiClient::TokenTimestamp
|
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe 'TokenTimestamp' do
|
|
21
|
+
before do
|
|
22
|
+
# run before each test
|
|
23
|
+
@instance = CloudmersiveVoiceRecognitionApiClient::TokenTimestamp.new
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
after do
|
|
27
|
+
# run after each test
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe 'test an instance of TokenTimestamp' do
|
|
31
|
+
it 'should create an instance of TokenTimestamp' do
|
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveVoiceRecognitionApiClient::TokenTimestamp)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
describe 'test attribute "token"' do
|
|
36
|
+
it 'should work' do
|
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe 'test attribute "character_offset_start"' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe 'test attribute "character_offset_end"' do
|
|
48
|
+
it 'should work' do
|
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe 'test attribute "start_time_ms"' do
|
|
54
|
+
it 'should work' do
|
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe 'test attribute "end_time_ms"' do
|
|
60
|
+
it 'should work' do
|
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudmersive-voice-recognition-api-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cloudmersive
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|
|
@@ -34,42 +34,42 @@ dependencies:
|
|
|
34
34
|
name: json
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: 2.1.0
|
|
40
37
|
- - "~>"
|
|
41
38
|
- !ruby/object:Gem::Version
|
|
42
39
|
version: '2.1'
|
|
40
|
+
- - ">="
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: 2.1.0
|
|
43
43
|
type: :runtime
|
|
44
44
|
prerelease: false
|
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
|
-
- - ">="
|
|
48
|
-
- !ruby/object:Gem::Version
|
|
49
|
-
version: 2.1.0
|
|
50
47
|
- - "~>"
|
|
51
48
|
- !ruby/object:Gem::Version
|
|
52
49
|
version: '2.1'
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 2.1.0
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
name: rspec
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
|
-
- - ">="
|
|
58
|
-
- !ruby/object:Gem::Version
|
|
59
|
-
version: 3.6.0
|
|
60
57
|
- - "~>"
|
|
61
58
|
- !ruby/object:Gem::Version
|
|
62
59
|
version: '3.6'
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: 3.6.0
|
|
63
63
|
type: :development
|
|
64
64
|
prerelease: false
|
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
|
-
- - ">="
|
|
68
|
-
- !ruby/object:Gem::Version
|
|
69
|
-
version: 3.6.0
|
|
70
67
|
- - "~>"
|
|
71
68
|
- !ruby/object:Gem::Version
|
|
72
69
|
version: '3.6'
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: 3.6.0
|
|
73
73
|
- !ruby/object:Gem::Dependency
|
|
74
74
|
name: vcr
|
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -206,6 +206,7 @@ files:
|
|
|
206
206
|
- "./docs/SpeakApi.md"
|
|
207
207
|
- "./docs/SpeechRecognitionResult.md"
|
|
208
208
|
- "./docs/TextToSpeechRequest.md"
|
|
209
|
+
- "./docs/TokenTimestamp.md"
|
|
209
210
|
- "./git_push.sh"
|
|
210
211
|
- "./lib/cloudmersive-voice-recognition-api-client.rb"
|
|
211
212
|
- "./lib/cloudmersive-voice-recognition-api-client/api/recognize_api.rb"
|
|
@@ -215,6 +216,7 @@ files:
|
|
|
215
216
|
- "./lib/cloudmersive-voice-recognition-api-client/configuration.rb"
|
|
216
217
|
- "./lib/cloudmersive-voice-recognition-api-client/models/speech_recognition_result.rb"
|
|
217
218
|
- "./lib/cloudmersive-voice-recognition-api-client/models/text_to_speech_request.rb"
|
|
219
|
+
- "./lib/cloudmersive-voice-recognition-api-client/models/token_timestamp.rb"
|
|
218
220
|
- "./lib/cloudmersive-voice-recognition-api-client/version.rb"
|
|
219
221
|
- "./spec/api/recognize_api_spec.rb"
|
|
220
222
|
- "./spec/api/speak_api_spec.rb"
|
|
@@ -222,12 +224,13 @@ files:
|
|
|
222
224
|
- "./spec/configuration_spec.rb"
|
|
223
225
|
- "./spec/models/speech_recognition_result_spec.rb"
|
|
224
226
|
- "./spec/models/text_to_speech_request_spec.rb"
|
|
227
|
+
- "./spec/models/token_timestamp_spec.rb"
|
|
225
228
|
- "./spec/spec_helper.rb"
|
|
226
229
|
homepage: https://www.cloudmersive.com/voice-recognition-and-speech-api
|
|
227
230
|
licenses:
|
|
228
231
|
- Apache 2.0
|
|
229
232
|
metadata: {}
|
|
230
|
-
post_install_message:
|
|
233
|
+
post_install_message:
|
|
231
234
|
rdoc_options: []
|
|
232
235
|
require_paths:
|
|
233
236
|
- lib
|
|
@@ -242,8 +245,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
242
245
|
- !ruby/object:Gem::Version
|
|
243
246
|
version: '0'
|
|
244
247
|
requirements: []
|
|
245
|
-
rubygems_version: 3.
|
|
246
|
-
signing_key:
|
|
248
|
+
rubygems_version: 3.5.16
|
|
249
|
+
signing_key:
|
|
247
250
|
specification_version: 4
|
|
248
251
|
summary: The most powerful and cost-effective speech recognition and voice AI APIs,
|
|
249
252
|
continuously updated.
|