76 | );
77 | };
78 |
79 | export default App;
80 |
--------------------------------------------------------------------------------
/src/components/Toast/Toast.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { ToastNotification } from '@carbon/react';
4 |
5 | const NOTIFICATION_HAS_BEEN_SEEN = 'notificationHasBeenSeen';
6 |
7 | export const Toast = ({
8 | caption,
9 | children,
10 | className,
11 | hideAfterFirstDisplay,
12 | hideCloseButton,
13 | kind,
14 | lowContrast,
15 | onCloseButtonClick,
16 | role,
17 | subtitle,
18 | timeout,
19 | title,
20 | }) => {
21 | const [id, setId] = useState();
22 | const [hideToast, setHideToast] = useState(false);
23 |
24 | useEffect(() => {
25 | setId(
26 | Math.random()
27 | .toString(36)
28 | .substring(2, 15) +
29 | Math.random()
30 | .toString(36)
31 | .substring(2, 15),
32 | );
33 | }, []);
34 |
35 | useEffect(() => {
36 | const element = document.querySelector(`.custom-toast-${id}`);
37 | if (element) {
38 | element.className += 'enter';
39 | }
40 | }, [id]);
41 |
42 | useEffect(() => {
43 | if (
44 | hideAfterFirstDisplay &&
45 | typeof window !== 'undefined' &&
46 | typeof window.localStorage !== 'undefined' &&
47 | window.localStorage.getItem(NOTIFICATION_HAS_BEEN_SEEN) === 'true'
48 | ) {
49 | setHideToast(true);
50 | }
51 | }, [hideAfterFirstDisplay]);
52 |
53 | return hideToast ? null : (
54 | {
61 | if (
62 | hideAfterFirstDisplay &&
63 | typeof window !== 'undefined' &&
64 | typeof window.localStorage !== 'undefined'
65 | ) {
66 | window.localStorage.setItem(NOTIFICATION_HAS_BEEN_SEEN, 'true');
67 | }
68 | onCloseButtonClick();
69 | }}
70 | role={role}
71 | subtitle={subtitle}
72 | timeout={timeout}
73 | title={title}
74 | >
75 | {children}
76 |
77 | );
78 | };
79 |
80 | Toast.propTypes = {
81 | caption: PropTypes.string,
82 | children: PropTypes.node,
83 | className: PropTypes.string,
84 | hideAfterFirstDisplay: PropTypes.bool,
85 | hideCloseButton: PropTypes.bool,
86 | kind: PropTypes.string,
87 | lowContrast: PropTypes.bool,
88 | onCloseButtonClick: PropTypes.func,
89 | role: PropTypes.string,
90 | subtitle: PropTypes.string,
91 | timeout: PropTypes.number,
92 | title: PropTypes.string,
93 | };
94 |
95 | Toast.defaultProps = {
96 | caption: '',
97 | children: null,
98 | className: '',
99 | hideAfterFirstDisplay: true,
100 | hideCloseButton: false,
101 | kind: 'error',
102 | lowContrast: false,
103 | onCloseButtonClick: () => {},
104 | role: 'alert',
105 | subtitle: '',
106 | timeout: 0,
107 | title: '',
108 | };
109 |
110 | export default Toast;
111 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ibm-watson/speech-to-text-code-pattern",
3 | "version": "0.1.0",
4 | "proxy": "http://localhost:5000",
5 | "private": true,
6 | "dependencies": {
7 | "@craco/craco": "^7.0.0",
8 | "@types/react": "^18.0.12",
9 | "body-parser": "^1.20.1",
10 | "buffer": "^6.0.3",
11 | "concurrently": "^7.6.0",
12 | "cross-env": "^7.0.3",
13 | "dotenv": "^16.0.3",
14 | "es6-promise": "^4.2.8",
15 | "express": "^4.18.2",
16 | "express-rate-limit": "^6.7.0",
17 | "express-secure-only": "^0.2.1",
18 | "helmet": "^6.0.1",
19 | "husky": "^8.0.3",
20 | "ibm-watson": "^7.1.2",
21 | "isomorphic-fetch": "^3.0.0",
22 | "lint-staged": "^13.1.2",
23 | "morgan": "^1.10.0",
24 | "process": "^0.11.10",
25 | "stream-browserify": "^3.0.0",
26 | "vcap_services": "^0.7.1",
27 | "watson-speech": "^0.41.0"
28 | },
29 | "scripts": {
30 | "dev": "concurrently \"npm:client\" \"npm:server\"",
31 | "client": "craco start",
32 | "server": "nodemon server.js",
33 | "start": "node server.js",
34 | "build": "INLINE_RUNTIME_CHUNK=false craco build",
35 | "test": "npm run test:components && npm run test:integration",
36 | "test:components": "cross-env CI=true craco test --env=jsdom --passWithNoTests",
37 | "test:integration": "JEST_PUPPETEER_CONFIG='test/jest-puppeteer.config.js' jest test -c test/jest.config.js",
38 | "prepare": "husky install"
39 | },
40 | "eslintConfig": {
41 | "extends": "react-app"
42 | },
43 | "engines": {
44 | "node": "^18.0.0"
45 | },
46 | "browserslist": {
47 | "production": [
48 | ">0.2%",
49 | "not dead",
50 | "not op_mini all"
51 | ],
52 | "development": [
53 | "last 1 chrome version",
54 | "last 1 firefox version",
55 | "last 1 safari version"
56 | ]
57 | },
58 | "lint-staged": {
59 | "./**/*.{js,scss,html,png,yaml,yml}": [
60 | "npm run build"
61 | ]
62 | },
63 | "devDependencies": {
64 | "@carbon/react": "^1.22.0",
65 | "@testing-library/jest-dom": "^5.16.5",
66 | "@testing-library/react": "^12.1.5",
67 | "@testing-library/user-event": "^14.4.3",
68 | "jest": "29.4.2",
69 | "jest-puppeteer": "^7.0.0",
70 | "nodemon": "^2.0.20",
71 | "prettier": "^2.8.4",
72 | "puppeteer": "^19",
73 | "react": "^17.0.2",
74 | "react-dom": "^17.0.2",
75 | "react-json-tree": "^0.18.0",
76 | "react-json-view": "^1.21.3",
77 | "react-scripts": "^5.0.1",
78 | "sass": "^1.58.0",
79 | "webpack": "^5.75.0"
80 | },
81 | "overrides": {
82 | "@craco/craco": {
83 | "react-scripts": "5.0.1"
84 | }
85 | },
86 | "prettier": {
87 | "trailingComma": "all",
88 | "singleQuote": true
89 | },
90 | "nodemonConfig": {
91 | "watch": [
92 | "app.js",
93 | "config/**/*.js",
94 | "server.js"
95 | ],
96 | "ext": "js",
97 | "ignore": [
98 | ".git",
99 | "node_modules",
100 | "public",
101 | "src",
102 | "test"
103 | ],
104 | "delay": 500
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/MAINTAINERS.md:
--------------------------------------------------------------------------------
1 | # Maintainers Guide
2 |
3 | This guide is intended for maintainers - anybody with commit access to one or
4 | more Code Pattern repositories.
5 |
6 | ## Methodology
7 |
8 | This repository does not have a traditional release management cycle, but
9 | should instead be maintained as a useful, working, and polished reference at
10 | all times. While all work can therefore be focused on the master branch, the
11 | quality of this branch should never be compromised.
12 |
13 | The remainder of this document details how to merge pull requests to the
14 | repositories.
15 |
16 | ## Merge approval
17 |
18 | The project maintainers use LGTM (Looks Good To Me) in comments on the pull
19 | request to indicate acceptance prior to merging. A change requires LGTMs from
20 | two project maintainers. If the code is written by a maintainer, the change
21 | only requires one additional LGTM.
22 |
23 | ## Reviewing Pull Requests
24 |
25 | We recommend reviewing pull requests directly within GitHub. This allows a
26 | public commentary on changes, providing transparency for all users. When
27 | providing feedback be civil, courteous, and kind. Disagreement is fine, so long
28 | as the discourse is carried out politely. If we see a record of uncivil or
29 | abusive comments, we will revoke your commit privileges and invite you to leave
30 | the project.
31 |
32 | During your review, consider the following points:
33 |
34 | ### Does the change have positive impact?
35 |
36 | Some proposed changes may not represent a positive impact to the project. Ask
37 | whether or not the change will make understanding the code easier, or if it
38 | could simply be a personal preference on the part of the author (see
39 | [bikeshedding](https://en.wiktionary.org/wiki/bikeshedding)).
40 |
41 | Pull requests that do not have a clear positive impact should be closed without
42 | merging.
43 |
44 | ### Do the changes make sense?
45 |
46 | If you do not understand what the changes are or what they accomplish, ask the
47 | author for clarification. Ask the author to add comments and/or clarify test
48 | case names to make the intentions clear.
49 |
50 | At times, such clarification will reveal that the author may not be using the
51 | code correctly, or is unaware of features that accommodate their needs. If you
52 | feel this is the case, work up a code sample that would address the pull
53 | request for them, and feel free to close the pull request once they confirm.
54 |
55 | ### Does the change introduce a new feature?
56 |
57 | For any given pull request, ask yourself "is this a new feature?" If so, does
58 | the pull request (or associated issue) contain narrative indicating the need
59 | for the feature? If not, ask them to provide that information.
60 |
61 | Are new unit tests in place that test all new behaviors introduced? If not, do
62 | not merge the feature until they are! Is documentation in place for the new
63 | feature? (See the documentation guidelines). If not do not merge the feature
64 | until it is! Is the feature necessary for general use cases? Try and keep the
65 | scope of any given component narrow. If a proposed feature does not fit that
66 | scope, recommend to the user that they maintain the feature on their own, and
67 | close the request. You may also recommend that they see if the feature gains
68 | traction among other users, and suggest they re-submit when they can show such
69 | support.
70 |
--------------------------------------------------------------------------------
/src/components/ServiceContainer/reducer.js:
--------------------------------------------------------------------------------
1 | export const actionTypes = {
2 | setAudioAnalyzer: 'SET_AUDIO_ANALYZER',
3 | setAudioContext: 'SET_AUDIO_CONTEXT',
4 | setAudioSource: 'SET_AUDIO_SOURCE',
5 | setAudioStream: 'SET_AUDIO_STREAM',
6 | setAudioVisualizationData: 'SET_AUDIO_VISUALIZATION_DATA',
7 | setError: 'SET_ERROR',
8 | setSpeakerLabels: 'SET_SPEAKER_LABELS',
9 | setIsRecording: 'SET_IS_RECORDING',
10 | setIsSamplePlaying: 'SET_IS_SAMPLE_PLAYING',
11 | setIsTranscribing: 'SET_IS_TRANSCRIBING',
12 | setIsUploadPlaying: 'SET_IS_UPLOAD_PLAYING',
13 | updateResults: 'UPDATE_RESULTS',
14 | };
15 |
16 | export const initialState = {
17 | audioAnalyzer: {},
18 | audioContext: null,
19 | audioDataArray: [],
20 | audioDurationInMs: 0,
21 | audioSource: '',
22 | audioStream: null,
23 | error: null,
24 | isRecording: false,
25 | isSamplePlaying: false,
26 | isTranscribing: false,
27 | isUploadPlaying: false,
28 | keywordInfo: [],
29 | speakerLabels: [],
30 | transcript: [],
31 | };
32 |
33 | export const reducer = (state, action) => {
34 | switch (action.type) {
35 | case 'SET_AUDIO_ANALYZER': {
36 | return {
37 | ...state,
38 | audioAnalyzer: action.audioAnalyzer,
39 | };
40 | }
41 | case 'SET_AUDIO_CONTEXT': {
42 | return {
43 | ...state,
44 | audioContext: action.audioContext,
45 | };
46 | }
47 | case 'SET_AUDIO_SOURCE': {
48 | return {
49 | ...state,
50 | audioSource: action.audioSource,
51 | };
52 | }
53 | case 'SET_AUDIO_STREAM': {
54 | return {
55 | ...state,
56 | audioStream: action.audioStream,
57 | };
58 | }
59 | case 'SET_AUDIO_VISUALIZATION_DATA': {
60 | return {
61 | ...state,
62 | audioDataArray: action.audioDataArray,
63 | audioDurationInMs: action.audioDurationInMs,
64 | };
65 | }
66 | case 'SET_ERROR': {
67 | return {
68 | ...state,
69 | error: action.error,
70 | };
71 | }
72 | case 'SET_IS_RECORDING': {
73 | return {
74 | ...state,
75 | isRecording: action.isRecording,
76 | };
77 | }
78 | case 'SET_IS_SAMPLE_PLAYING': {
79 | return {
80 | ...state,
81 | isSamplePlaying: action.isSamplePlaying,
82 | };
83 | }
84 | case 'SET_IS_TRANSCRIBING': {
85 | return {
86 | ...state,
87 | isTranscribing: action.isTranscribing,
88 | };
89 | }
90 | case 'SET_IS_UPLOAD_PLAYING': {
91 | return {
92 | ...state,
93 | isUploadPlaying: action.isUploadPlaying,
94 | };
95 | }
96 | case 'SET_SPEAKER_LABELS': {
97 | return {
98 | ...state,
99 | speakerLabels: action.speakerLabels,
100 | };
101 | }
102 | case 'UPDATE_RESULTS': {
103 | let updatedTranscript = [...state.transcript];
104 | if (action.resultIndex === 0) {
105 | updatedTranscript = action.transcript;
106 | } else {
107 | updatedTranscript[action.resultIndex] = action.transcript[0];
108 | }
109 |
110 | return {
111 | ...state,
112 | keywordInfo: action.keywordInfo,
113 | transcript: updatedTranscript,
114 | };
115 | }
116 | default: {
117 | throw new Error();
118 | }
119 | }
120 | };
121 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | const { Cp4dTokenManager, IamTokenManager } = require('ibm-watson/auth');
2 | const path = require('path');
3 | const express = require('express');
4 | const vcapServices = require('vcap_services');
5 | const app = express();
6 | require('./config/express')(app);
7 |
8 | // For starter kit env.
9 | require('dotenv').config({
10 | silent: true
11 | });
12 | const skitJson = JSON.parse(process.env.service_watson_speech_to_text || "{}");
13 | const vcapCredentials = vcapServices.getCredentials('speech_to_text');
14 |
15 | // Look for credentials in all the possible places
16 | const apikey = process.env.SPEECH_TO_TEXT_APIKEY || process.env.SPEECHTOTEXT_APIKEY || vcapCredentials?.apikey || skitJson?.apikey;
17 | const url = process.env.SPEECH_TO_TEXT_URL || process.env.SPEECHTOTEXT_URL || vcapCredentials?.url || skitJson?.url;
18 |
19 | let bearerToken = process.env.SPEECH_TO_TEXT_BEARER_TOKEN;
20 |
21 | // Ensure we have a SPEECH_TO_TEXT_AUTH_TYPE so we can get a token for the UI.
22 | let sttAuthType = process.env.SPEECH_TO_TEXT_AUTH_TYPE;
23 | if (!sttAuthType) {
24 | sttAuthType = 'iam';
25 | } else {
26 | sttAuthType = sttAuthType.toLowerCase();
27 | }
28 | // Get a token manager for IAM or CP4D.
29 | let tokenManager = false;
30 | if (sttAuthType === 'cp4d') {
31 | tokenManager = new Cp4dTokenManager({
32 | username: process.env.SPEECH_TO_TEXT_USERNAME,
33 | password: process.env.SPEECH_TO_TEXT_PASSWORD,
34 | url: process.env.SPEECH_TO_TEXT_AUTH_URL,
35 | disableSslVerification: process.env.SPEECH_TO_TEXT_AUTH_DISABLE_SSL || false
36 | });
37 | } else if (sttAuthType === 'iam') {
38 | try {
39 | tokenManager = new IamTokenManager({ apikey });
40 | } catch (err) {
41 | console.log("Error: ", err);
42 | }
43 | } else if (sttAuthType === 'bearertoken') {
44 | console.log('SPEECH_TO_TEXT_AUTH_TYPE=bearertoken is for dev use only.');
45 | } else {
46 | console.log('SPEECH_TO_TEXT_AUTH_TYPE =', sttAuthType);
47 | console.log('SPEECH_TO_TEXT_AUTH_TYPE is not recognized.');
48 | }
49 |
50 | const getToken = async () => {
51 | let tokenResponse = {};
52 |
53 | try {
54 | if (tokenManager) {
55 | const token = await tokenManager.getToken();
56 | tokenResponse = {
57 | ...tokenResponse,
58 | accessToken: token,
59 | url,
60 | };
61 | } else if (bearerToken && url) {
62 | tokenResponse = {
63 | ...tokenResponse,
64 | accessToken: bearerToken,
65 | url,
66 | };
67 | } else {
68 | tokenResponse = {
69 | ...tokenResponse,
70 | error: {
71 | title: 'No valid credentials found',
72 | description:
73 | 'Could not find valid credentials for the Speech to Text service.',
74 | statusCode: 401,
75 | },
76 | };
77 | }
78 | } catch (err) {
79 | console.log("Error: ", err);
80 | tokenResponse = {
81 | ...tokenResponse,
82 | error: {
83 | title: 'Authentication error',
84 | description:
85 | 'There was a problem authenticating with the Speech to Text service.',
86 | statusCode: 400,
87 | },
88 | };
89 | }
90 |
91 | return tokenResponse;
92 | };
93 |
94 | app.get('/', (_, res) => {
95 | res.sendFile(path.join(__dirname, 'build', 'index.html'));
96 | });
97 |
98 | app.get('/health', (_, res) => {
99 | res.json({ status: 'UP' });
100 | });
101 |
102 | app.get('/api/auth', async (_, res, next) => {
103 | const token = await getToken();
104 |
105 | if (token.error) {
106 | console.error(token.error);
107 | next(token.error);
108 | } else {
109 | return res.json(token);
110 | }
111 | });
112 |
113 | // error-handler settings for all other routes
114 | require('./config/error-handler')(app);
115 |
116 | module.exports = app;
117 |
--------------------------------------------------------------------------------
/doc/source/local.md:
--------------------------------------------------------------------------------
1 | # Run locally
2 |
3 | This document shows how to run the `speech-to-text-code-pattern` application on your local machine.
4 |
5 | ## Steps
6 |
7 | 1. [Clone the repo](#clone-the-repo)
8 | 1. [Configure credentials](#configure-credentials)
9 | 1. [Start the server](#start-the-server)
10 |
11 | ### Clone the repo
12 |
13 | Clone `speech-to-text-code-pattern` repo locally. In a terminal, run:
14 |
15 | ```bash
16 | git clone https://github.com/IBM/speech-to-text-code-pattern
17 | cd speech-to-text-code-pattern
18 | ```
19 |
20 | ### Configure credentials
21 |
22 | Copy the `.env.example` file to `.env`.
23 |
24 | ```bash
25 | cp .env.example .env
26 | ```
27 |
28 | Edit the `.env` file to configure credentials before starting the Node.js server.
29 | The credentials to configure will depend on whether you are provisioning services using IBM Cloud Pak for Data or on IBM Cloud.
30 |
31 | Click to expand one:
32 |
33 | IBM Cloud Pak for Data
34 |
35 |
36 | For the **Speech to Text** service, the following settings are needed:
37 |
38 | * Set SPEECH_TO_TEXT_AUTH_TYPE to cp4d
39 | * Provide the SPEECH_TO_TEXT_URL, SPEECH_TO_TEXT_USERNAME and SPEECH_TO_TEXT_PASSWORD collected in the previous step.
40 | * For the SPEECH_TO_TEXT_AUTH_URL use the base fragment of your URL including the host and port. I.e. https://{cpd_cluster_host}{:port}.
41 | * If your CPD installation is using a self-signed certificate, you need to disable SSL verification with SPEECH_TO_TEXT_AUTH_DISABLE_SSL set to true. You might also need to use browser-specific steps to ignore certificate errors (try browsing to the AUTH_URL). Disable SSL only if absolutely necessary, and take steps to enable SSL as soon as possible.
42 | * Make sure the examples for IBM Cloud and bearer token auth are commented out (or removed).
43 |
44 | ```bash
45 | #----------------------------------------------------------
46 | # IBM Cloud Pak for Data (username and password)
47 | #
48 | # If your services are running on IBM Cloud Pak for Data,
49 | # uncomment and configure these.
50 | # Remove or comment out the IBM Cloud section.
51 | #----------------------------------------------------------
52 |
53 | SPEECH_TO_TEXT_AUTH_TYPE=cp4d
54 | SPEECH_TO_TEXT_URL=https://{cpd_cluster_host}{:port}/speech-to-text/{release}/instances/{instance_id}/api
55 | SPEECH_TO_TEXT_AUTH_URL=https://{cpd_cluster_host}{:port}
56 | SPEECH_TO_TEXT_USERNAME=
57 | SPEECH_TO_TEXT_PASSWORD=
58 | # If you use a self-signed certificate, you need to disable SSL verification.
59 | # This is not secure and not recommended.
60 | # SPEECH_TO_TEXT_AUTH_DISABLE_SSL=true
61 | ```
62 |
63 |
64 |
65 |
66 | IBM Cloud
67 |
68 |
69 | For the Speech to Text service, the following settings are needed:
70 |
71 | * Set SPEECH_TO_TEXT_AUTH_TYPE to iam
72 | * Provide the SPEECH_TO_TEXT_URL and SPEECH_TO_TEXT_APIKEY collected in the previous step.
73 | * Make sure the examples for IBM Cloud Pak for Data and bearer token auth are commented out (or removed).
74 |
75 |
76 | ```bash
77 | #----------------------------------------------------------
78 | # IBM Cloud
79 | #
80 | # If your services are running on IBM Cloud,
81 | # uncomment and configure these.
82 | # Remove or comment out the IBM Cloud Pak for Data sections.
83 | #----------------------------------------------------------
84 |
85 | SPEECH_TO_TEXT_AUTH_TYPE=iam
86 | SPEECH_TO_TEXT_APIKEY=
87 | SPEECH_TO_TEXT_URL=
88 | ```
89 |
90 |
91 |
92 |
93 | > Need more information? See the [authentication wiki](https://github.com/IBM/node-sdk-core/blob/master/AUTHENTICATION.md).
94 |
95 | ### Start the server
96 |
97 | ```bash
98 | npm install
99 | npm start
100 | ```
101 |
102 | The application will be available in your browser at http://localhost:5000. Return to the README.md for instructions on how to use the app.
103 |
104 | [](../../README.md#3-use-the-app)
105 |
--------------------------------------------------------------------------------
/src/components/ServiceContainer/utils.js:
--------------------------------------------------------------------------------
1 | const AUDIO_VISUALIZATION_DIMENSIONS = {
2 | DATA_POINT_WIDTH: 1,
3 | DATA_POINT_HEIGHT: 50,
4 | DATA_POINT_MARGIN: 2,
5 | DATA_POINT_X_OFFSET: 25,
6 | DATA_POINT_Y_OFFSET: 50,
7 | };
8 |
9 | const readFileToArrayBuffer = fileData => {
10 | const fileReader = new FileReader();
11 |
12 | return new Promise((resolve, reject) => {
13 | fileReader.onload = () => {
14 | const arrayBuffer = fileReader.result;
15 | resolve(arrayBuffer);
16 | };
17 |
18 | fileReader.onerror = () => {
19 | fileReader.abort();
20 | reject(new Error('failed to process file'));
21 | };
22 |
23 | // Initiate the conversion.
24 | fileReader.readAsArrayBuffer(fileData);
25 | });
26 | };
27 |
28 | export const formatStreamData = data => {
29 | const { results, result_index: resultIndex } = data;
30 |
31 | let finalKeywords = [];
32 | const finalTranscript = [];
33 | let isFinal = false;
34 |
35 | results.forEach(result => {
36 | const { final } = result;
37 | let alternatives = null;
38 | let speaker = null;
39 | let keywords_result = null;
40 |
41 | if (final) {
42 | ({ alternatives, speaker, keywords_result } = result);
43 | } else {
44 | ({ alternatives, speaker } = result);
45 | }
46 |
47 | // Extract the main alternative to get keywords.
48 | const [mainAlternative] = alternatives;
49 | const { transcript } = mainAlternative;
50 |
51 | if (speaker === undefined) {
52 | speaker = null;
53 | }
54 |
55 | // Push object to final transcript.
56 | finalTranscript.push({
57 | final,
58 | speaker,
59 | text: transcript,
60 | });
61 |
62 | isFinal = final;
63 |
64 | // Push keywords to final keyword list.
65 | if (keywords_result) {
66 | finalKeywords.push(keywords_result);
67 | }
68 | });
69 |
70 | return {
71 | transcript: finalTranscript,
72 | keywordInfo: finalKeywords,
73 | resultIndex,
74 | final: isFinal,
75 | };
76 | };
77 |
78 | export const convertAudioBlobToVisualizationData = async (
79 | audioBlob,
80 | audioCtx,
81 | audioWaveContainerWidth,
82 | ) => {
83 | const audioArrayBuffer = await readFileToArrayBuffer(audioBlob);
84 | const audioUint8Array = new Uint8Array(audioArrayBuffer.slice(0));
85 |
86 | // NOTE: BaseAudioContext.decodeAudioData has a promise syntax
87 | // which we are unable to use in order to be compatible with Safari.
88 | // Therefore, we wrap the callback syntax in a promise to give us the same
89 | // effect while ensuring compatibility
90 | // see more: https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/decodeAudioData#Browser_compatibility
91 | return new Promise((resolve, reject) => {
92 | audioCtx.decodeAudioData(
93 | audioArrayBuffer,
94 | audioDataBuffer => {
95 | const { duration } = audioDataBuffer;
96 |
97 | const { DATA_POINT_MARGIN } = AUDIO_VISUALIZATION_DIMENSIONS;
98 | const validContainerWidth =
99 | audioWaveContainerWidth - DATA_POINT_MARGIN * 2;
100 | const numberOfChunks = Math.floor(validContainerWidth / 2);
101 | const chunkSize = audioUint8Array.length / numberOfChunks;
102 |
103 | const chunkedAudioDataArray = [];
104 | for (let i = 1; i < numberOfChunks; i += 1) {
105 | let previousIndex = i - 1;
106 | if (previousIndex < 0) {
107 | previousIndex = 0;
108 | }
109 |
110 | chunkedAudioDataArray.push(
111 | audioUint8Array.slice(previousIndex * chunkSize, i * chunkSize),
112 | );
113 | }
114 |
115 | const reducedFloatArray = chunkedAudioDataArray.map(chunk => {
116 | const totalValue = chunk.reduce(
117 | (prevValue, currentValue) => prevValue + currentValue,
118 | );
119 | const floatValue = totalValue / (chunkSize * 255);
120 | return floatValue;
121 | });
122 |
123 | resolve({
124 | duration,
125 | reducedFloatArray,
126 | });
127 | },
128 | () => {
129 | reject(new Error('failed to chunk audio'));
130 | },
131 | );
132 | });
133 | };
134 |
--------------------------------------------------------------------------------
/src/components/TranscriptBox/TranscriptBox.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import { DefinitionTooltip } from '@carbon/react';
4 | import KeywordTooltip from '../KeywordTooltip';
5 | import { createWordRegex } from './utils';
6 |
7 | const mapTranscriptTextToElements = (text, keywordInfo, totalIndex) => {
8 | let finalSentenceArray = [];
9 | let matches = [];
10 |
11 | if (keywordInfo.length > 0) {
12 | const regex = createWordRegex(keywordInfo);
13 | matches = text.split(regex);
14 | }
15 |
16 | // If we don't have words to find yet, just return the interim text.
17 | if (matches.length === 0) {
18 | return [
19 | {
20 | text,
21 | type: 'normal',
22 | },
23 | ];
24 | }
25 |
26 | const wordOccurences = {};
27 | finalSentenceArray = matches.map((sentenceFragment, index) => {
28 | // Use lowercased version when searching through keyword map.
29 | const fragmentToSearch = sentenceFragment.toLowerCase();
30 |
31 | if (index % 2 === 0) {
32 | return {
33 | text: sentenceFragment,
34 | type: 'normal',
35 | };
36 | }
37 |
38 | // Find keyword info object to use based on text from sentenceFragment and
39 | // current index in wordOccurences.
40 | const keywordInfoMatch =
41 | keywordInfo[totalIndex] && keywordInfo[totalIndex][fragmentToSearch];
42 | let keywordOccurenceIndex = 0;
43 | if (wordOccurences[fragmentToSearch]) {
44 | keywordOccurenceIndex = wordOccurences[fragmentToSearch];
45 | wordOccurences[fragmentToSearch] += 1;
46 | } else {
47 | wordOccurences[fragmentToSearch] = 1;
48 | }
49 | const infoForOccurence =
50 | keywordInfoMatch && keywordInfoMatch[keywordOccurenceIndex];
51 |
52 | // Bail in case we can't get the keyword info for whatever reason.
53 | if (!infoForOccurence) {
54 | return {};
55 | }
56 |
57 | return {
58 | text: sentenceFragment,
59 | type: 'keyword',
60 | startTime: infoForOccurence.start_time,
61 | endTime: infoForOccurence.end_time,
62 | confidence: infoForOccurence.confidence,
63 | };
64 | });
65 |
66 | return finalSentenceArray;
67 | };
68 |
69 | export const TranscriptBox = ({ keywordInfo, transcriptArray }) => {
70 | return (
71 |
54 |
55 |
64 |
65 |
66 |
79 |
80 | {
88 | setUseSpeakerLabels(!useSpeakerLabels);
89 | }}
90 | />
91 |
92 |
107 |
108 | );
109 | };
110 |
111 | ControlContainer.propTypes = {
112 | isRecording: PropTypes.bool,
113 | isSamplePlaying: PropTypes.bool,
114 | isUploadPlaying: PropTypes.bool,
115 | onError: PropTypes.func,
116 | onSelectNewModel: PropTypes.func,
117 | onStartPlayingFileUpload: PropTypes.func,
118 | onStopPlayingFileUpload: PropTypes.func,
119 | onStartPlayingSample: PropTypes.func,
120 | onStopPlayingSample: PropTypes.func,
121 | onStartRecording: PropTypes.func,
122 | onStopRecording: PropTypes.func,
123 | };
124 |
125 | ControlContainer.defaultProps = {
126 | isRecording: false,
127 | isSamplePlaying: false,
128 | isUploadPlaying: false,
129 | onError: () => {},
130 | onSelectNewModel: () => {},
131 | onStartPlayingFileUpload: () => {},
132 | onStopPlayingFileUpload: () => {},
133 | onStartPlayingSample: () => {},
134 | onStopPlayingSample: () => {},
135 | onStartRecording: () => {},
136 | onStopRecording: () => {},
137 | };
138 |
139 | export default ControlContainer;
140 |
--------------------------------------------------------------------------------
/doc/source/openshift.md:
--------------------------------------------------------------------------------
1 | # Run on Red Hat OpenShift
2 |
3 | This document shows how to deploy the server using Red Hat OpenShift.
4 |
5 | ## Prerequisites
6 |
7 | You will need a running OpenShift cluster, or OKD cluster. You can provision [OpenShift on the IBM Cloud](https://cloud.ibm.com/kubernetes/catalog/openshiftcluster).
8 |
9 | ## Steps
10 |
11 | 1. [Create an OpenShift project](#create-an-openshift-project)
12 | 1. [Create the config map](#create-the-config-map)
13 | 1. [Get a secure endpoint](#get-a-secure-endpoint)
14 | 1. [Run the web app](#run-the-web-app)
15 |
16 | ## Create an OpenShift project
17 |
18 | * Using the OpenShift web console, select the `Application Console` view.
19 |
20 | 
21 |
22 | * Use the `+Create Project` button to create a new project, then click on your project to open it.
23 |
24 | * In the `Overview` tab, click on `Browse Catalog`.
25 |
26 | 
27 |
28 | * Choose the `Node.js` app container and click `Next`.
29 |
30 | 
31 |
32 | * Give your application a name and add `https://github.com/IBM/speech-to-text-code-pattern` for the `Git Repository`, then click `Create`.
33 |
34 | 
35 |
36 | ## Create the config map
37 |
38 | Create a config map to configure credentials for the Node.js server.
39 |
40 | * Click on the `Resources` tab and choose `Config Maps` and then click the `Create Config Map` button.
41 | * Provide a `Name` for the config map.
42 | * Add items with keys and values. The necessary keys to configure will depend on whether you are provisioning services using IBM Cloud Pak for Data or on IBM Cloud.
43 |
44 | Click to expand one:
45 |
46 | IBM Cloud Pak for Data
47 |
48 |
49 | For the Speech to Text service, the following settings are needed:
50 |
51 | * Set SPEECH_TO_TEXT_AUTH_TYPE to cp4d
52 | * Provide the SPEECH_TO_TEXT_URL, SPEECH_TO_TEXT_USERNAME and SPEECH_TO_TEXT_PASSWORD for the user added to this service instance.
53 | * For the SPEECH_TO_TEXT_AUTH_URL use the base fragment of your URL including the host and port. I.e. https://{cpd_cluster_host}{:port}.
54 | * If your CPD installation is using a self-signed certificate, you need to disable SSL verification with SPEECH_TO_TEXT_AUTH_DISABLE_SSL set to true. You might also need to use browser-specific steps to ignore certificate errors (try browsing to the AUTH_URL). Disable SSL only if absolutely necessary, and take steps to enable SSL as soon as possible.
55 |
56 | | Key | Value |
57 | | --- | --- |
58 | | SPEECH_TO_TEXT_AUTH_TYPE | cp4d |
59 | | SPEECH_TO_TEXT_URL | https://{cpd_cluster_host}{:port}/speech-to-text/{release}/instances/{instance_id}/api |
60 | | SPEECH_TO_TEXT_AUTH_URL | https://{cpd_cluster_host}{:port} |
61 | | SPEECH_TO_TEXT_USERNAME | |
62 | | SPEECH_TO_TEXT_PASSWORD | |
63 | | SPEECH_TO_TEXT_AUTH_DISABLE_SSL | true or false |
64 | | PORT | 8080 |
65 |
66 |
67 |
68 |
69 | IBM Cloud
70 |
71 |
72 | For the Speech to Text service, the following settings are needed:
73 |
74 | * Set SPEECH_TO_TEXT_AUTH_TYPE to iam
75 | * Provide the SPEECH_TO_TEXT_URL and SPEECH_TO_TEXT_APIKEY collected when you created the services.
76 |
77 | | Key | Value |
78 | | --- | --- |
79 | | SPEECH_TO_TEXT_AUTH_TYPE | iam |
80 | | SPEECH_TO_TEXT_APIKEY | |
81 | | SPEECH_TO_TEXT_URL | |
82 | | PORT | 8080 |
83 |
84 |
85 |
86 |
87 | Create the config map and add it to your application.
88 |
89 | * Hit the `Create` button.
90 | * Click on your new Config Map's name.
91 | * Click the `Add to Application` button.
92 | * Select your application from the pulldown.
93 | * Click `Save`.
94 | * Go to the `Applications` tab, choose `Deployments` to view the status of your application.
95 |
96 | ## Get a secure endpoint
97 |
98 | * From the OpenShift or OKD UI, under `Applications` ▷ `Routes` you will see your app.
99 | * Click on the application `Name`.
100 | * Under `TLS Settings`, click on `Edit`.
101 | * Under `Security`, check the box for `Secure route`.
102 | * Hit `Save`.
103 |
104 | ## Run the web app
105 |
106 | * Go back to `Applications` ▷ `Routes`. You will see your app.
107 | * Click your app's `Hostname`. This will open the Speech to Text web app in your browser.
108 | * Go back to the README.md for instructions on how to use the app.
109 |
110 | [](../../README.md#3-use-the-app)
--------------------------------------------------------------------------------
/src/serviceWorker.js:
--------------------------------------------------------------------------------
1 | // This optional code is used to register a service worker.
2 | // register() is not called by default.
3 |
4 | // This lets the app load faster on subsequent visits in production, and gives
5 | // it offline capabilities. However, it also means that developers (and users)
6 | // will only see deployed updates on subsequent visits to a page, after all the
7 | // existing tabs open on the page have been closed, since previously cached
8 | // resources are updated in the background.
9 |
10 | // To learn more about the benefits of this model and instructions on how to
11 | // opt-in, read https://bit.ly/CRA-PWA
12 |
13 | const isLocalhost = Boolean(
14 | window.location.hostname === 'localhost' ||
15 | // [::1] is the IPv6 localhost address.
16 | window.location.hostname === '[::1]' ||
17 | // 127.0.0.0/8 are considered localhost for IPv4.
18 | window.location.hostname.match(
19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
20 | )
21 | );
22 |
23 | export function register(config) {
24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
25 | // The URL constructor is available in all browsers that support SW.
26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
27 | if (publicUrl.origin !== window.location.origin) {
28 | // Our service worker won't work if PUBLIC_URL is on a different origin
29 | // from what our page is served on. This might happen if a CDN is used to
30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374
31 | return;
32 | }
33 |
34 | window.addEventListener('load', () => {
35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
36 |
37 | if (isLocalhost) {
38 | // This is running on localhost. Let's check if a service worker still exists or not.
39 | checkValidServiceWorker(swUrl, config);
40 |
41 | // Add some additional logging to localhost, pointing developers to the
42 | // service worker/PWA documentation.
43 | navigator.serviceWorker.ready.then(() => {
44 | console.log(
45 | 'This web app is being served cache-first by a service ' +
46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA'
47 | );
48 | });
49 | } else {
50 | // Is not localhost. Just register service worker
51 | registerValidSW(swUrl, config);
52 | }
53 | });
54 | }
55 | }
56 |
57 | function registerValidSW(swUrl, config) {
58 | navigator.serviceWorker
59 | .register(swUrl)
60 | .then(registration => {
61 | registration.onupdatefound = () => {
62 | const installingWorker = registration.installing;
63 | if (installingWorker == null) {
64 | return;
65 | }
66 | installingWorker.onstatechange = () => {
67 | if (installingWorker.state === 'installed') {
68 | if (navigator.serviceWorker.controller) {
69 | // At this point, the updated precached content has been fetched,
70 | // but the previous service worker will still serve the older
71 | // content until all client tabs are closed.
72 | console.log(
73 | 'New content is available and will be used when all ' +
74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
75 | );
76 |
77 | // Execute callback
78 | if (config && config.onUpdate) {
79 | config.onUpdate(registration);
80 | }
81 | } else {
82 | // At this point, everything has been precached.
83 | // It's the perfect time to display a
84 | // "Content is cached for offline use." message.
85 | console.log('Content is cached for offline use.');
86 |
87 | // Execute callback
88 | if (config && config.onSuccess) {
89 | config.onSuccess(registration);
90 | }
91 | }
92 | }
93 | };
94 | };
95 | })
96 | .catch(error => {
97 | console.error('Error during service worker registration:', error);
98 | });
99 | }
100 |
101 | function checkValidServiceWorker(swUrl, config) {
102 | // Check if the service worker can be found. If it can't reload the page.
103 | fetch(swUrl, {
104 | headers: { 'Service-Worker': 'script' }
105 | })
106 | .then(response => {
107 | // Ensure service worker exists, and that we really are getting a JS file.
108 | const contentType = response.headers.get('content-type');
109 | if (
110 | response.status === 404 ||
111 | (contentType != null && contentType.indexOf('javascript') === -1)
112 | ) {
113 | // No service worker found. Probably a different app. Reload the page.
114 | navigator.serviceWorker.ready.then(registration => {
115 | registration.unregister().then(() => {
116 | window.location.reload();
117 | });
118 | });
119 | } else {
120 | // Service worker found. Proceed as normal.
121 | registerValidSW(swUrl, config);
122 | }
123 | })
124 | .catch(() => {
125 | console.log(
126 | 'No internet connection found. App is running in offline mode.'
127 | );
128 | });
129 | }
130 |
131 | export function unregister() {
132 | if ('serviceWorker' in navigator) {
133 | navigator.serviceWorker.ready.then(registration => {
134 | registration.unregister();
135 | });
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WARNING: This repository is no longer maintained :warning:
2 |
3 | > This repository will not be updated. The repository will be kept available in read-only mode.
4 |
5 | [](https://github.com/IBM/speech-to-text-code-pattern/actions/workflows/nodejs.yml)
6 |
7 | # Speech to Text Code Pattern
8 |
9 | Sample React app for playing around with the Watson Speech to Text service.
10 |
11 | ✨ **Demo:** https://speech-to-text-code-pattern.ng.bluemix.net/ ✨
12 |
13 | 
14 |
15 | ## Flow
16 |
17 | 1. User supplies an audio input to the application (running locally, in the IBM Cloud or in IBM Cloud Pak for Data).
18 | 1. The application sends the audio data to the Watson Speech to Text service through a [WebSocket connection](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websockets).
19 | 1. As the data is processed, the Speech to Text service returns information about extracted text and other metadata to the application to display.
20 |
21 | ## Steps
22 |
23 | 1. [Provision Watson Speech to Text](#1-Provision-Watson-Speech-to-Text)
24 | 2. [Deploy the server](#2-Deploy-the-server)
25 | 3. [Use the web app](#3-Use-the-web-app)
26 |
27 | ## 1. Provision Watson Speech to Text
28 |
29 | The instructions will depend on whether you are provisioning services using IBM Cloud Pak for Data or on IBM Cloud.
30 |
31 | **Click to expand one:**
32 |
33 | IBM Cloud Pak for Data
34 |
35 |
36 |
Install and provision
37 |
38 | The service is not available by default. An administrator must install it on the IBM Cloud Pak for Data platform, and you must be given access to the service. To determine whether the service is installed, click the Services icon () and check whether the service is enabled.
39 |
40 |
Gather credentials
41 |
42 |
43 |
For production use, create a user to use for authentication. From the main navigation menu (☰), select Administer > Manage users and then + New user.
44 |
From the main navigation menu (☰), select My instances.
45 |
On the Provisioned instances tab, find your service instance, and then hover over the last column to find and click the ellipses icon. Choose View details.
46 |
Copy the URL to use as the SPEECH_TO_TEXT_URL when you configure credentials.
47 |
Optionally, copy the Bearer token to use in development testing only. It is not recommended to use the bearer token except during testing and development because that token does not expire.
48 |
Use the Menu and select Users and + Add user to grant your user access to this service instance. This is the SPEECH_TO_TEXT_USERNAME (and SPEECH_TO_TEXT_PASSWORD) you will use when you configure credentials to allow the Node.js server to authenticate.
49 |
50 |
51 |
52 |
53 | IBM Cloud
54 |
55 |
Create the service instance
56 |
57 | * If you do not have an IBM Cloud account, register for a free trial account [here](https://cloud.ibm.com/registration).
58 | * Click [here](https://cloud.ibm.com/catalog/services/speech-to-text) to create a **Speech to Text** instance.
59 | * `Select a region`.
60 | * `Select a pricing plan` (**Lite** is *free*).
61 | * Set your `Service name` or use the generated one.
62 | * Click `Create`.
63 | * Gather credentials
64 | * Copy the API Key and URL to use when you configure and [deploy the server](#2-Deploy-the-server).
65 |
66 | > If you need to find the service later, use the main navigation menu (☰) and select **Resource list** to find the service under **Services**.
67 | Click on the service name to get back to the **Manage** view (where you can collect the **API Key** and **URL**).
68 |
69 |
70 |
71 | ## 2. Deploy the server
72 |
73 | Click on one of the options below for instructions on deploying the Node.js server.
74 |
75 | | | |
76 | | - | - |
77 | | [](doc/source/local.md) | [](doc/source/openshift.md) |
78 |
79 | ## 3. Use the web app
80 |
81 | * Select an input `Language model` (defaults to English).
82 |
83 | * Press the `Play audio sample` button to hear our example audio and watch as it is transcribed.
84 |
85 | * Press the `Record your own` button to transcribe audio from your microphone. Press the button again to stop (the button label becomes `Stop recording`).
86 |
87 | * Use the `Upload file` button to transcribe audio from a file.
88 |
89 | 
90 |
91 | ## Developing and testing
92 |
93 | See [DEVELOPING.md](DEVELOPING.md) and [TESTING.md](TESTING.md) for more details about developing and testing this app.
94 |
95 | ## License
96 |
97 | This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the [Developer Certificate of Origin, Version 1.1](https://developercertificate.org/) and the [Apache License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt).
98 |
99 | [Apache License FAQ](https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN)
100 |
--------------------------------------------------------------------------------
/src/components/SubmitContainer/SubmitContainer.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Button, FileUploaderButton } from '@carbon/react';
4 | import fetch from 'isomorphic-fetch';
5 | import models from '../../data/models.json';
6 |
7 | export const SubmitContainer = ({
8 | isRecording,
9 | isSamplePlaying,
10 | isUploadPlaying,
11 | keywordText,
12 | modelName,
13 | onError,
14 | onStartPlayingFileUpload,
15 | onStopPlayingFileUpload,
16 | onStartPlayingSample,
17 | onStopPlayingSample,
18 | onStartRecording,
19 | onStopRecording,
20 | useSpeakerLabels,
21 | }) => {
22 | const [keywordList, setKeywordList] = useState([]);
23 | useEffect(() => {
24 | let newKeywordList = [];
25 | if (keywordText.length > 0) {
26 | newKeywordList = keywordText.split(',').map(k => k.trim());
27 | }
28 | setKeywordList(newKeywordList);
29 | }, [keywordText]);
30 |
31 | const sampleModelInfo = models.find(model => model.name === modelName);
32 | const sampleModelFilename = sampleModelInfo ? sampleModelInfo.filename : null;
33 |
34 | const getBaseAudioConfig = async () => {
35 | let authResponse;
36 | let authJson;
37 | authResponse = await fetch('/api/auth');
38 | authJson = await authResponse.json();
39 | if (!authResponse.ok) {
40 | onError(authJson);
41 | return {
42 | error: authJson,
43 | };
44 | }
45 |
46 | let options = {};
47 |
48 | // We'll lowercase these so that we can ignore cases when highlighting keyword
49 | // occurrences later on.
50 | const lowerCasedKeywords = keywordList.map(keyword =>
51 | keyword.toLowerCase(),
52 | );
53 |
54 | options = {
55 | ...options,
56 | url: authJson.url || undefined,
57 | accessToken: authJson.accessToken,
58 | format: true,
59 | keywords: keywordList.length > 0 ? lowerCasedKeywords : undefined,
60 | keywordsThreshold: keywordList.length > 0 ? 0.01 : undefined,
61 | model: modelName,
62 | objectMode: true,
63 | play: true,
64 | realtime: true,
65 | resultsBySpeaker: useSpeakerLabels,
66 | speakerlessInterim: true,
67 | timestamps: true,
68 | };
69 |
70 | return options;
71 | };
72 |
73 | const getSampleAudioConfig = async () => {
74 | const baseConfig = await getBaseAudioConfig();
75 | return {
76 | ...baseConfig,
77 | file: `audio/${sampleModelFilename}`,
78 | };
79 | };
80 |
81 | const getMicrophoneAudioConfig = async () => {
82 | const baseConfig = await getBaseAudioConfig();
83 | return {
84 | ...baseConfig,
85 | resultsBySpeaker: false,
86 | };
87 | };
88 |
89 | const getUploadAudioConfig = async file => {
90 | const baseConfig = await getBaseAudioConfig();
91 | return {
92 | ...baseConfig,
93 | file,
94 | resultsBySpeaker: false,
95 | };
96 | };
97 |
98 | return (
99 |
372 | );
373 | };
374 |
375 | export default ServiceContainer;
376 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/src/data/models.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "en-US_BroadbandModel",
4 | "language": "en-US",
5 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/en-US_BroadbandModel",
6 | "rate": 16000,
7 | "filename": "en-US_Broadband-sample.wav",
8 | "keywords": "IBM, admired, AI, transformations, cognitive",
9 | "supported_features": {
10 | "custom_language_model": true,
11 | "speaker_labels": true
12 | },
13 | "description": "US English (16khz Broadband)"
14 | },
15 | {
16 | "name": "en-US_NarrowbandModel",
17 | "language": "en-US",
18 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/en-US_NarrowbandModel",
19 | "rate": 8000,
20 | "filename": "en-US_Narrowband-sample.wav",
21 | "keywords": "course online, four hours, help",
22 | "supported_features": {
23 | "custom_language_model": true,
24 | "speaker_labels": true
25 | },
26 | "description": "US English (8khz Narrowband)"
27 | },
28 | {
29 | "name": "en-US_ShortForm_NarrowbandModel",
30 | "language": "en-US",
31 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/en-US_ShortForm_NarrowbandModel",
32 | "rate": 8000,
33 | "filename": "en-US_ShortForm_Narrowband-sample.wav",
34 | "keywords": "twenty thousand dollars, filled out, car",
35 | "supported_features": {
36 | "custom_language_model": true,
37 | "speaker_labels": true
38 | },
39 | "description": "US English Short Form (8khz Narrowband)"
40 | },
41 | {
42 | "name": "fr-FR_BroadbandModel",
43 | "language": "fr-FR",
44 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/fr-FR_BroadbandModel",
45 | "rate": 16000,
46 | "filename": "fr-FR_Broadband-sample.wav",
47 | "keywords": "durée du travail, loisirs",
48 | "supported_features": {
49 | "custom_language_model": true,
50 | "speaker_labels": false
51 | },
52 | "description": "French (16khz Broadband)"
53 | },
54 | {
55 | "name": "fr-FR_NarrowbandModel",
56 | "language": "fr-FR",
57 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/fr-FR_NarrowbandModel",
58 | "rate": 8000,
59 | "filename": "fr-FR_Narrowband-sample.wav",
60 | "keywords": "durée du travail, loisirs",
61 | "supported_features": {
62 | "custom_language_model": true,
63 | "speaker_labels": true
64 | },
65 | "description": "French (8khz Narrowband)"
66 | },
67 | {
68 | "name": "pt-BR_BroadbandModel",
69 | "language": "pt-BR",
70 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/pt-BR_BroadbandModel",
71 | "rate": 16000,
72 | "filename": "pt-BR_Broadband-sample.wav",
73 | "keywords": "sistema da ibm, setor bancário, qualidade, necessidades dos clientes",
74 | "supported_features": {
75 | "custom_language_model": true,
76 | "speaker_labels": false
77 | },
78 | "description": "Brazilian Portuguese (16khz Broadband)"
79 | },
80 | {
81 | "name": "pt-BR_NarrowbandModel",
82 | "language": "pt-BR",
83 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/pt-BR_NarrowbandModel",
84 | "rate": 8000,
85 | "filename": "pt-BR_Narrowband-sample.wav",
86 | "keywords": "cozinha, inovadoras receitas, criatividade",
87 | "supported_features": {
88 | "custom_language_model": true,
89 | "speaker_labels": false
90 | },
91 | "description": "Brazilian Portuguese (8khz Narrowband)"
92 | },
93 | {
94 | "name": "ja-JP_BroadbandModel",
95 | "language": "ja-JP",
96 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/ja-JP_BroadbandModel",
97 | "rate": 16000,
98 | "filename": "ja-JP_Broadband-sample.wav",
99 | "keywords": "音声認識, ディープラーニング, 技術",
100 | "supported_features": {
101 | "custom_language_model": true,
102 | "speaker_labels": true
103 | },
104 | "description": "Japanese (16khz Broadband)"
105 | },
106 | {
107 | "name": "ja-JP_NarrowbandModel",
108 | "language": "ja-JP",
109 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/ja-JP_NarrowbandModel",
110 | "rate": 8000,
111 | "filename": "ja-JP_Narrowband-sample.wav",
112 | "keywords": "ご住所, ご本人, 生年月日",
113 | "supported_features": {
114 | "custom_language_model": true,
115 | "speaker_labels": true
116 | },
117 | "description": "Japanese (8khz Narrowband)"
118 | },
119 | {
120 | "name": "zh-CN_BroadbandModel",
121 | "language": "zh-CN",
122 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/zh-CN_BroadbandModel",
123 | "rate": 16000,
124 | "filename": "zh-CN_Broadband-sample.wav",
125 | "keywords": "沃 森 是 认知 , 大 数据 分析 能力",
126 | "supported_features": {
127 | "custom_language_model": false,
128 | "speaker_labels": false
129 | },
130 | "description": "Mandarin (16khz Broadband)"
131 | },
132 | {
133 | "name": "zh-CN_NarrowbandModel",
134 | "language": "zh-CN",
135 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/zh-CN_NarrowbandModel",
136 | "rate": 8000,
137 | "filename": "zh-CN_Narrowband-sample.wav",
138 | "keywords": "公司 的 支持 , 理财 计划",
139 | "supported_features": {
140 | "custom_language_model": false,
141 | "speaker_labels": false
142 | },
143 | "description": "Mandarin (8khz Narrowband)"
144 | },
145 | {
146 | "name": "ko-KR_BroadbandModel",
147 | "language": "ko-KR",
148 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/ko-KR_BroadbandModel",
149 | "rate": 16000,
150 | "filename": "ko-KR_Broadband-sample.wav",
151 | "keywords": "네 명, 숙박, 호텔, 싱글룸, 두개, 예약",
152 | "supported_features": {
153 | "custom_language_model": true,
154 | "speaker_labels": false
155 | },
156 | "description": "Korean (16khz Broadband)"
157 | },
158 | {
159 | "name": "ko-KR_NarrowbandModel",
160 | "language": "ko-KR",
161 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/ko-KR_NarrowbandModel",
162 | "rate": 8000,
163 | "filename": "ko-KR_Narrowband-sample.wav",
164 | "keywords": "생명보험사, 상담원, 본인 확인, 성함, 생년월일, 휴대폰 번호",
165 | "supported_features": {
166 | "custom_language_model": true,
167 | "speaker_labels": false
168 | },
169 | "description": "Korean (8khz Narrowband)"
170 | },
171 | {
172 | "name": "es-ES_BroadbandModel",
173 | "language": "es-ES",
174 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-ES_BroadbandModel",
175 | "rate": 16000,
176 | "filename": "es-ES_Broadband-sample.wav",
177 | "keywords": "Roberto, Pedro",
178 | "supported_features": {
179 | "custom_language_model": true,
180 | "speaker_labels": true
181 | },
182 | "description": "Spanish (16khz Broadband)"
183 | },
184 | {
185 | "name": "es-ES_NarrowbandModel",
186 | "language": "es-ES",
187 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-ES_NarrowbandModel",
188 | "rate": 8000,
189 | "filename": "es-ES_Narrowband-sample.wav",
190 | "keywords": "México, Grecia, diciembre",
191 | "supported_features": {
192 | "custom_language_model": true,
193 | "speaker_labels": true
194 | },
195 | "description": "Spanish (8khz Narrowband)"
196 | },
197 | {
198 | "name": "ar-AR_BroadbandModel",
199 | "language": "ar-AR",
200 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/ar-AR_BroadbandModel",
201 | "rate": 16000,
202 | "filename": "ar-AR_Broadband-sample.wav",
203 | "keywords": "الطقس , رياح معتدلة",
204 | "supported_features": {
205 | "custom_language_model": false,
206 | "speaker_labels": false
207 | },
208 | "description": "Modern Standard Arabic (16khz Broadband)"
209 | },
210 | {
211 | "name": "en-GB_BroadbandModel",
212 | "language": "en-GB",
213 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/en-GB_BroadbandModel",
214 | "rate": 16000,
215 | "filename": "en-GB_Broadband-sample.wav",
216 | "keywords": "important industry, affordable travel, business",
217 | "supported_features": {
218 | "custom_language_model": true,
219 | "speaker_labels": false
220 | },
221 | "description": "GB English (16khz Broadband)"
222 | },
223 | {
224 | "name": "en-GB_NarrowbandModel",
225 | "language": "en-GB",
226 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/en-GB_NarrowbandModel",
227 | "rate": 8000,
228 | "filename": "en-GB_Narrowband-sample.wav",
229 | "keywords": "heavy rain, northwest, UK",
230 | "supported_features": {
231 | "custom_language_model": true,
232 | "speaker_labels": false
233 | },
234 | "description": "GB English (8khz Narrowband)"
235 | },
236 | {
237 | "name": "de-DE_BroadbandModel",
238 | "language": "de-DE",
239 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/de-DE_BroadbandModel",
240 | "rate": 16000,
241 | "filename": "de-DE_Broadband-sample.wav",
242 | "keywords": "diskussion, künstlicher intelligenz, möglichkeiten, grundprinzipien",
243 | "supported_features": {
244 | "custom_language_model": true,
245 | "speaker_labels": false
246 | },
247 | "description": "German (16khz Broadband)"
248 | },
249 | {
250 | "name": "de-DE_NarrowbandModel",
251 | "language": "de-DE",
252 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/de-DE_NarrowbandModel",
253 | "rate": 8000,
254 | "filename": "de-DE_Narrowband-sample.wav",
255 | "keywords": "Augen, linden bäumen, Türme von Wien",
256 | "supported_features": {
257 | "custom_language_model": true,
258 | "speaker_labels": false
259 | },
260 | "description": "German (8khz Narrowband)"
261 | },
262 | {
263 | "name": "es-AR_BroadbandModel",
264 | "language": "es-AR",
265 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-AR_BroadbandModel",
266 | "rate": 16000,
267 | "filename": "es-ES_Broadband-sample.wav",
268 | "keywords": "Roberto, Pedro",
269 | "supported_features": {
270 | "custom_language_model": true,
271 | "speaker_labels": true
272 | },
273 | "description": "Argentinian Spanish (16khz Broadband)"
274 | },
275 | {
276 | "name": "es-AR_NarrowbandModel",
277 | "language": "es-AR",
278 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-AR_NarrowbandModel",
279 | "rate": 8000,
280 | "filename": "es-ES_Narrowband-sample.wav",
281 | "keywords": "Roberto, Pedro",
282 | "supported_features": {
283 | "custom_language_model": true,
284 | "speaker_labels": true
285 | },
286 | "description": "Argentinian Spanish (8khz Narrowband)"
287 | },
288 | {
289 | "name": "es-CL_BroadbandModel",
290 | "language": "es-CL",
291 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-CL_BroadbandModel",
292 | "rate": 16000,
293 | "filename": "es-ES_Broadband-sample.wav",
294 | "keywords": "Roberto, Pedro",
295 | "supported_features": {
296 | "custom_language_model": true,
297 | "speaker_labels": true
298 | },
299 | "description": "Chilean Spanish (16khz Broadband)"
300 | },
301 | {
302 | "name": "es-CL_NarrowbandModel",
303 | "language": "es-CL",
304 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-CL_NarrowbandModel",
305 | "rate": 8000,
306 | "filename": "es-ES_Narrowband-sample.wav",
307 | "keywords": "Roberto, Pedro",
308 | "supported_features": {
309 | "custom_language_model": true,
310 | "speaker_labels": true
311 | },
312 | "description": "Chilean Spanish (8khz Narrowband)"
313 | },
314 | {
315 | "name": "es-CO_BroadbandModel",
316 | "language": "es-CO",
317 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-CO_BroadbandModel",
318 | "rate": 16000,
319 | "filename": "es-ES_Broadband-sample.wav",
320 | "keywords": "Roberto, Pedro",
321 | "supported_features": {
322 | "custom_language_model": true,
323 | "speaker_labels": true
324 | },
325 | "description": "Colombian Spanish (16khz Broadband)"
326 | },
327 | {
328 | "name": "es-CO_NarrowbandModel",
329 | "language": "es-CO",
330 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-CO_NarrowbandModel",
331 | "rate": 8000,
332 | "filename": "es-ES_Narrowband-sample.wav",
333 | "keywords": "Roberto, Pedro",
334 | "supported_features": {
335 | "custom_language_model": true,
336 | "speaker_labels": true
337 | },
338 | "description": "Colombian Spanish (8khz Narrowband)"
339 | },
340 | {
341 | "name": "es-MX_BroadbandModel",
342 | "language": "es-MX",
343 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-MX_BroadbandModel",
344 | "rate": 16000,
345 | "filename": "es-ES_Broadband-sample.wav",
346 | "keywords": "Roberto, Pedro",
347 | "supported_features": {
348 | "custom_language_model": true,
349 | "speaker_labels": true
350 | },
351 | "description": "Mexican Spanish (16khz Broadband)"
352 | },
353 | {
354 | "name": "es-MX_NarrowbandModel",
355 | "language": "es-MX",
356 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-MX_NarrowbandModel",
357 | "rate": 8000,
358 | "filename": "es-ES_Narrowband-sample.wav",
359 | "keywords": "Roberto, Pedro",
360 | "supported_features": {
361 | "custom_language_model": true,
362 | "speaker_labels": true
363 | },
364 | "description": "Mexican Spanish (8khz Narrowband)"
365 | },
366 | {
367 | "name": "es-PE_BroadbandModel",
368 | "language": "es-PE",
369 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-PE_BroadbandModel",
370 | "rate": 16000,
371 | "filename": "es-ES_Broadband-sample.wav",
372 | "keywords": "Roberto, Pedro",
373 | "supported_features": {
374 | "custom_language_model": true,
375 | "speaker_labels": true
376 | },
377 | "description": "Peruvian Spanish (16khz Broadband)"
378 | },
379 | {
380 | "name": "es-PE_NarrowbandModel",
381 | "language": "es-PE",
382 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-PE_NarrowbandModel",
383 | "rate": 8000,
384 | "filename": "es-ES_Narrowband-sample.wav",
385 | "keywords": "Roberto, Pedro",
386 | "supported_features": {
387 | "custom_language_model": true,
388 | "speaker_labels": true
389 | },
390 | "description": "Peruvian Spanish (8khz Narrowband)"
391 | },
392 | {
393 | "name": "nl-NL_BroadbandModel",
394 | "language": "nl-NL",
395 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/nl-NL_BroadbandModel",
396 | "rate": 16000,
397 | "filename": "nl-NL_Broadband-sample.wav",
398 | "keywords": "bestelling, voertuig, auto, aanvraag",
399 | "supported_features": {
400 | "custom_language_model": false,
401 | "speaker_labels": false
402 | },
403 | "description": "Dutch (16khz Broadband)"
404 | },
405 | {
406 | "name": "nl-NL_NarrowbandModel",
407 | "language": "nl-NL",
408 | "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/nl-NL_NarrowbandModel",
409 | "rate": 8000,
410 | "filename": "nl-NL_Narrowband-sample.wav",
411 | "keywords": "bestelling, voertuig, auto, aanvraag",
412 | "supported_features": {
413 | "custom_language_model": false,
414 | "speaker_labels": true
415 | },
416 | "description": "Dutch (8khz Narrowband)"
417 | }
418 | ]
--------------------------------------------------------------------------------