Skip to content

Commit 8cd1669

Browse files
yoshi-automationchingor13
authored andcommitted
feat: add speaker_tag to WordInfo (#40)
* [CHANGE ME] Re-generated to pick up changes in the API or client library generator. * fix: allow proto interface changes
1 parent f88cae0 commit 8cd1669

18 files changed

+541
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Transcribe Audio File using Long Running Operation (Local File) (LRO)
6+
cases:
7+
8+
# This sample should default to using brooklyn_bridge.raw
9+
# with explicitly configured sample_rate_hertz and encoding
10+
- name: speech_transcribe_async (no arguments)
11+
spec:
12+
- call:
13+
sample: speech_transcribe_async
14+
- assert_contains:
15+
- literal: "how old is the Brooklyn Bridge"
16+
17+
# Confirm that another file can be transcribed (use another .raw PCM file)
18+
- name: speech_transcribe_async (--local_file_path)
19+
spec:
20+
- call:
21+
sample: speech_transcribe_async
22+
params:
23+
local_file_path:
24+
literal: "resources/hello.raw"
25+
- assert_contains:
26+
- literal: "hello"
27+
- assert_not_contains:
28+
- literal: "how old is the Brooklyn Bridge"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Transcript Audio File using Long Running Operation (Cloud Storage) (LRO)
6+
cases:
7+
8+
# This sample should default to using gs://cloud-samples-data/brooklyn_bridge.raw
9+
# with explicitly configured sample_rate_hertz and encoding
10+
- name: speech_transcribe_async_gcs (no arguments)
11+
spec:
12+
- call:
13+
sample: speech_transcribe_async_gcs
14+
- assert_contains:
15+
- literal: "how old is the Brooklyn Bridge"
16+
17+
# Confirm that another file can be transcribed (use another .raw PCM file)
18+
- name: speech_transcribe_async_gcs (--storage_uri)
19+
spec:
20+
- call:
21+
sample: speech_transcribe_async_gcs
22+
params:
23+
storage_uri:
24+
literal: "gs://cloud-samples-data/speech/hello.raw"
25+
- assert_contains:
26+
- literal: "hello"
27+
- assert_not_contains:
28+
- literal: "how old is the Brooklyn Bridge"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Getting word timestamps (Cloud Storage) (LRO)
6+
cases:
7+
8+
# This sample should default to using gs://cloud-samples-data/speech/brooklyn_bridge.flac
9+
- name: speech_transcribe_async_word_time_offsets_gcs (no arguments)
10+
spec:
11+
- call:
12+
sample: speech_transcribe_async_word_time_offsets_gcs
13+
- assert_contains:
14+
- literal: "how old is the Brooklyn Bridge"
15+
- literal: "Word: how"
16+
- literal: "Word: old"
17+
- literal: "Word: is"
18+
- literal: "Start time: 0 seconds"
19+
- literal: "End time: 1 seconds"
20+
21+
# Confirm that another file can be transcribed (use another file)
22+
- name: speech_transcribe_async_word_time_offsets_gcs (--storage_uri)
23+
spec:
24+
- call:
25+
sample: speech_transcribe_async_word_time_offsets_gcs
26+
params:
27+
storage_uri:
28+
literal: "gs://cloud-samples-data/speech/multi.flac"
29+
- assert_contains:
30+
- literal: "how are you doing"
31+
- literal: "Word: how"
32+
- literal: "Word: are"
33+
- literal: "Word: you"
34+
- literal: "Start time: 0 seconds"
35+
- literal: "End time: 1 seconds"
36+
- assert_not_contains:
37+
- literal: "how old is the Brooklyn Bridge"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Using Enhanced Models (Local File)
6+
cases:
7+
8+
# This sample should default to using hello.wav
9+
# and the phone_call model (only currently available enhanced model)
10+
#
11+
# Note: if the project used to run these tests isn't eligible for
12+
# enhanced models, you will receive an error.
13+
- name: speech_transcribe_enhanced_model (no arguments)
14+
spec:
15+
- call:
16+
sample: speech_transcribe_enhanced_model
17+
- assert_contains:
18+
- literal: "hello"
19+
20+
# Confirm that another file can be transcribed (use another .wav file)
21+
- name: speech_transcribe_enhanced_model (--local_file_path)
22+
spec:
23+
- call:
24+
sample: speech_transcribe_enhanced_model
25+
params:
26+
local_file_path:
27+
literal: "resources/commercial_mono.wav"
28+
- assert_contains:
29+
- literal: "Chrome"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Selecting a Transcription Model (Local File)
6+
cases:
7+
8+
# This sample should default to using hello.wav
9+
# and the phone_call model
10+
- name: speech_transcribe_model_selection (no arguments)
11+
spec:
12+
- call:
13+
sample: speech_transcribe_model_selection
14+
- assert_contains:
15+
- literal: "Hello"
16+
17+
# Confirm that another file can be transcribed (use another .wav file)
18+
- name: speech_transcribe_model_selection (--local_file_path)
19+
spec:
20+
- call:
21+
sample: speech_transcribe_model_selection
22+
params:
23+
local_file_path:
24+
literal: "resources/commercial_mono.wav"
25+
- assert_contains:
26+
- literal: "Chrome"
27+
28+
# Confirm that --model can be specified and the sample does not blow up
29+
#
30+
# Note: we are not using example audio files which result in deterministically
31+
# different results when using different models. so we simply test
32+
# that regular transcription continues to work.
33+
- name: speech_transcribe_model_selection (--model)
34+
spec:
35+
- call:
36+
sample: speech_transcribe_model_selection
37+
params:
38+
model:
39+
literal: video
40+
- assert_contains:
41+
- literal: "hello"
42+
43+
# Confirm that --model is being passed through by providing an invalid model
44+
- name: speech_transcribe_model_selection (invalid --model)
45+
spec:
46+
- call_may_fail:
47+
sample: speech_transcribe_model_selection
48+
params:
49+
model:
50+
literal: I_DONT_EXIST
51+
- assert_contains:
52+
- literal: "Incorrect model specified"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Selecting a Transcription Model (Cloud Storage)
6+
cases:
7+
8+
# This sample should default to using gs://cloud-samples-data/speech/hello.wav
9+
# and the phone_call model
10+
- name: speech_transcribe_model_selection_gcs (no arguments)
11+
spec:
12+
- call:
13+
sample: speech_transcribe_model_selection_gcs
14+
- assert_contains:
15+
- literal: "Hello"
16+
17+
# Confirm that another file can be transcribed (use another .wav file)
18+
- name: speech_transcribe_model_selection_gcs (--local_file_path)
19+
spec:
20+
- call:
21+
sample: speech_transcribe_model_selection_gcs
22+
params:
23+
storage_uri:
24+
literal: "gs://cloud-samples-data/speech/commercial_mono.wav"
25+
- assert_contains:
26+
- literal: "Chrome"
27+
28+
# Confirm that --model can be specified and the sample does not blow up
29+
#
30+
# Note: we are not using example audio files which result in deterministically
31+
# different results when using different models. so we simply test
32+
# that regular transcription continues to work.
33+
- name: speech_transcribe_model_selection_gcs (--model)
34+
spec:
35+
- call:
36+
sample: speech_transcribe_model_selection_gcs
37+
params:
38+
model:
39+
literal: video
40+
- assert_contains:
41+
- literal: "hello"
42+
43+
# Confirm that --model is being passed through by providing an invalid model
44+
- name: speech_transcribe_model_selection_gcs (invalid --model)
45+
spec:
46+
- call_may_fail:
47+
sample: speech_transcribe_model_selection_gcs
48+
params:
49+
model:
50+
literal: I_DONT_EXIST
51+
- assert_contains:
52+
- literal: "Incorrect model specified"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Multi-Channel Audio Transcription (Local File)
6+
cases:
7+
8+
# This sample should default to using multi.wav (2 channels)
9+
- name: speech_transcribe_multichannel (no arguments)
10+
spec:
11+
- call:
12+
sample: speech_transcribe_multichannel
13+
- assert_contains:
14+
- literal: "Channel tag: 1"
15+
- literal: "Channel tag: 2"
16+
- literal: "how are you doing"
17+
18+
# Confirm that another file can be transcribed (use another 2 channel .wav file)
19+
- name: speech_transcribe_multichannel (--local_file_path)
20+
spec:
21+
- call:
22+
sample: speech_transcribe_multichannel
23+
params:
24+
local_file_path:
25+
literal: "resources/brooklyn_bridge.wav"
26+
- assert_contains:
27+
# Only one channel of data is present in brooklyn_bridge.wav
28+
- literal: "Channel tag:"
29+
- literal: "how old is the Brooklyn Bridge"
30+
- assert_not_contains:
31+
- literal: "how are you doing"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Multi-Channel Audio Transcription (Cloud Storage)
6+
cases:
7+
8+
# This sample should default to using gs://cloud-samples-data/speech/multi.wav
9+
# with 2 audio channels of data
10+
- name: speech_transcribe_multichannel_gcs (no arguments)
11+
spec:
12+
- call:
13+
sample: speech_transcribe_multichannel_gcs
14+
- assert_contains:
15+
- literal: "Channel tag: 1"
16+
- literal: "Channel tag: 2"
17+
- literal: "how are you doing"
18+
19+
# Confirm that another file can be transcribed (use another 2 channel .wav file)
20+
- name: speech_transcribe_multichannel_gcs (--storage_uri)
21+
spec:
22+
- call:
23+
sample: speech_transcribe_multichannel_gcs
24+
params:
25+
storage_uri:
26+
literal: "gs://cloud-samples-data/speech/brooklyn_bridge.wav"
27+
- assert_contains:
28+
# Only one channel of data is present in brooklyn_bridge.wav
29+
- literal: "Channel tag:"
30+
- literal: "how old is the Brooklyn Bridge"
31+
- assert_not_contains:
32+
- literal: "how are you doing"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Transcribe Audio File (Local File)
6+
cases:
7+
8+
# This sample should default to using brooklyn_bridge.raw
9+
# with explicitly configured sample_rate_hertz and encoding
10+
- name: speech_transcribe_sync (no arguments)
11+
spec:
12+
- call:
13+
sample: speech_transcribe_sync
14+
- assert_contains:
15+
- literal: "how old is the Brooklyn Bridge"
16+
17+
# Confirm that another file can be transcribed (use another .raw PCM file)
18+
- name: speech_transcribe_sync (--local_file_path)
19+
spec:
20+
- call:
21+
sample: speech_transcribe_sync
22+
params:
23+
local_file_path:
24+
literal: "resources/hello.raw"
25+
- assert_contains:
26+
- literal: "hello"
27+
- assert_not_contains:
28+
- literal: "how old is the Brooklyn Bridge"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
type: test/samples
2+
schema_version: 1
3+
test:
4+
suites:
5+
- name: Transcript Audio File (Cloud Storage)
6+
cases:
7+
8+
# This sample should default to using gs://cloud-samples-data/speech/brooklyn_bridge.raw
9+
# with explicitly configured sample_rate_hertz and encoding
10+
- name: speech_transcribe_sync_gcs (no arguments)
11+
spec:
12+
- call:
13+
sample: speech_transcribe_sync_gcs
14+
- assert_contains:
15+
- literal: "how old is the Brooklyn Bridge"
16+
17+
# Confirm that another file can be transcribed (use another .raw PCM file)
18+
- name: speech_transcribe_sync_gcs (--storage_uri)
19+
spec:
20+
- call:
21+
sample: speech_transcribe_sync_gcs
22+
params:
23+
storage_uri:
24+
literal: "gs://cloud-samples-data/speech/hello.raw"
25+
- assert_contains:
26+
- literal: "hello"
27+
- assert_not_contains:
28+
- literal: "how old is the Brooklyn Bridge"

0 commit comments

Comments
 (0)