私はテキストにスピーチで1人の専門家ではないんだけど、私はAPIリファレンスおよびIBMによるプロジェクトを使用して数ヶ月前に一例をしました。
あなたが見ることができるように、次の例は、 APIリファレンスに使用される、recognizeStream
は、テキストにスピーチのインスタンスに使用され、あなたが送っスピーチ、createRecognizeStream
functionNode SDKを認識用される。
あなたは他の変数を使用することができ、あなたの依存、しかし、あなたが必要ですテキストをスピーチにインスタンス化し、スピーチのイベントを認識するためにcreateRecogniseStreamを呼び出す。
サービスは、次の例のように、UTF8に設定した後、あなたのファイルを転写産物とテキストが認識トランスクリプトファイルを追加します:
var SpeechToTextV1 = require('watson-developer-cloud/speech-to-text/v1');
var fs = require('fs');
var speech_to_text = new SpeechToTextV1 ({
username: '{username}',
password: '{password}'
});
var params = {
model: 'en-US_BroadbandModel',
content_type: 'audio/flac',
'interim_results': true,
'max_alternatives': 3,
'word_confidence': false,
timestamps: false,
keywords: ['colorado', 'tornado', 'tornadoes'],
'keywords_threshold': 0.5
};
// Create the stream with the instancie of speech to text and access the function to Recognise the speech.
var recognizeStream = speech_to_text.createRecognizeStream(params);
// Pipe in the audio in the parameter recognizeStream.
fs.createReadStream('audio-file.flac').pipe(recognizeStream);
// Pipe out the transcription to a file.
recognizeStream.pipe(fs.createWriteStream('transcription.txt'));
// Get strings instead of buffers from 'data' events.
recognizeStream.setEncoding('utf8');
// Listen for events using the paramter after set utf8 and the transcrit file.
recognizeStream.on('results', function(event) { onEvent('Results:', event); });
recognizeStream.on('data', function(event) { onEvent('Data:', event); });
recognizeStream.on('error', function(event) { onEvent('Error:', event); });
recognizeStream.on('close', function(event) { onEvent('Close:', event); });
recognizeStream.on('speaker_labels', function(event) { onEvent('Speaker_Labels:', event); });
// Displays events on the console.
function onEvent(name, event) {
console.log(name, JSON.stringify(event, null, 2));
};
- は、Node.jsの
と音声をテキストに使用して
Officialリファレンスを参照してください。
- ProjectスピーチからテキストおよびNode.jsを使用するIBM開発者による