Skip to content

Commit 7b10b90

Browse files
authored
Merge pull request #13 from watson-developer-cloud/regenerate_speech_to_text_add_word
Regenerate speech to text add word
2 parents f2183ce + d2c1b57 commit 7b10b90

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

examples/speech_to_text_v1.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require("ibm_watson/speech_to_text_v1")
4+
require("ibm_watson/websocket/recognize_callback")
45
require("json")
56

67
# If using IAM

lib/ibm_watson/speech_to_text_v1.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ def add_words(customization_id:, words:)
15371537
end
15381538

15391539
##
1540-
# @!method add_word(customization_id:, word_name:, sounds_like: nil, display_as: nil)
1540+
# @!method add_word(customization_id:, word_name:, word: nil, sounds_like: nil, display_as: nil)
15411541
# Add a custom word.
15421542
# Adds a custom word to a custom language model. The service populates the words
15431543
# resource for a custom model with out-of-vocabulary (OOV) words found in each
@@ -1579,6 +1579,11 @@ def add_words(customization_id:, words:)
15791579
# @param word_name [String] The custom word for the custom language model. When you add or update a custom
15801580
# word with the **Add a custom word** method, do not include spaces in the word. Use
15811581
# a `-` (dash) or `_` (underscore) to connect the tokens of compound words.
1582+
# @param word [String] For the **Add custom words** method, you must specify the custom word that is to
1583+
# be added to or updated in the custom model. Do not include spaces in the word. Use
1584+
# a `-` (dash) or `_` (underscore) to connect the tokens of compound words.
1585+
#
1586+
# Omit this field for the **Add a custom word** method.
15821587
# @param sounds_like [Array[String]] An array of sounds-like pronunciations for the custom word. Specify how words that
15831588
# are difficult to pronounce, foreign words, acronyms, and so on can be pronounced
15841589
# by users. For a word that is not in the service's base vocabulary, omit the
@@ -1593,13 +1598,13 @@ def add_words(customization_id:, words:)
15931598
# the parameter when you want the word to have a spelling that is different from its
15941599
# usual representation or from its spelling in corpora training data.
15951600
# @return [nil]
1596-
def add_word(customization_id:, word_name:, sounds_like: nil, display_as: nil)
1601+
def add_word(customization_id:, word_name:, word: nil, sounds_like: nil, display_as: nil)
15971602
raise ArgumentError("customization_id must be provided") if customization_id.nil?
15981603
raise ArgumentError("word_name must be provided") if word_name.nil?
15991604
headers = {
16001605
}
16011606
data = {
1602-
"word" => word_name,
1607+
"word" => word,
16031608
"sounds_like" => sounds_like,
16041609
"display_as" => display_as
16051610
}

test/appveyor_status.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ class AppVeyorStatusTest < Minitest::Test
1414
def test_appveyor_status
1515
skip "Branch is NOT master and/or Ruby != 2.5.1, so AppVeyor check before deployment will not be run." if ENV["TRAVIS_BRANCH"] != "master" || ENV["TRAVIS_RUBY_VERSION"] != "2.5.1"
1616
client = HTTP::Client.new
17+
attempts = 0
1718
status = JSON.parse(client.get("https://ci.appveyor.com/api/projects/maxnussbaum/ruby-sdk").body.to_s)["build"]["status"]
19+
puts("0 AppVeyor Status: #{status}")
1820
while status != "success" && status != "failed" && status != "cancelled"
19-
sleep(3)
21+
attempts += 1
22+
sleep(15)
2023
status = JSON.parse(client.get("https://ci.appveyor.com/api/projects/maxnussbaum/ruby-sdk").body.to_s)["build"]["status"]
24+
puts("#{attempts} AppVeyor Status: #{status}")
2125
end
2226
if status == "success"
2327
assert(true)

test/unit/test_speech_to_text_v1.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def test_custom_words
408408
)
409409
stub_request(:put, "https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/custid/words/IEEE")
410410
.with(
411-
body: "{\"word\":\"IEEE\",\"sounds_like\":[\"i triple e\"],\"display_as\":\"IEEE\"}",
411+
body: "{\"sounds_like\":[\"i triple e\"],\"display_as\":\"IEEE\"}",
412412
headers: {
413413
"Accept" => "application/json",
414414
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",

0 commit comments

Comments
 (0)