천현우

voicoding update

...@@ -3,6 +3,7 @@ const recorder = require('node-record-lpcm16'); ...@@ -3,6 +3,7 @@ const recorder = require('node-record-lpcm16');
3 // Imports the Google Cloud client library 3 // Imports the Google Cloud client library
4 const speech = require('@google-cloud/speech'); 4 const speech = require('@google-cloud/speech');
5 5
6 +
6 // Creates a client 7 // Creates a client
7 const client = new speech.SpeechClient(); 8 const client = new speech.SpeechClient();
8 9
...@@ -12,12 +13,40 @@ const client = new speech.SpeechClient(); ...@@ -12,12 +13,40 @@ const client = new speech.SpeechClient();
12 const encoding = 'LINEAR16'; 13 const encoding = 'LINEAR16';
13 const sampleRateHertz = 16000; 14 const sampleRateHertz = 16000;
14 const languageCode = 'ko-KR'; 15 const languageCode = 'ko-KR';
16 +const speechContexts = [{
17 + phrases: [
18 + '$OOV_CLASS_ALPHA_SEQUENCE 는 $OOV_CLASS_ALPHA_SEQUENCE', '$OOV_CLASS_ALPHA_SEQUENCE 는 $OOV_CLASS_DIGIT_SEQUENCE',
19 + '$OOV_CLASS_ALPHA_SEQUENCE 는 $OOV_CLASS_ALPHA_SEQUENCE 보다 크다',
20 + '$OOV_CLASS_ALPHA_SEQUENCE 는 $OOV_CLASS_ALPHA_SEQUENCE 보다 작다',
21 + '$OOV_CLASS_ALPHA_SEQUENCE 는 $OOV_CLASS_DIGIT_SEQUENCE 보다 크다',
22 + '$OOV_CLASS_ALPHA_SEQUENCE 는 $OOV_CLASS_DIGIT_SEQUENCE 보다 작다',
23 + 'for OOV_CLASS_ALPHA_SEQUENCE in range $OOV_CLASS_DIGIT_SEQUENCE',
24 + 'if',
25 + '이프',
26 + 'else if',
27 + '엘스 이프',
28 + 'else',
29 + '엘스',
30 + 'while',
31 + '와일',
32 + '함수',
33 + '파라미터',
34 + 'parameter',
35 + '변수 선언',
36 + '함수 선언',
37 + '반복문 선언',
38 + '조건문 선언'
39 + ],
40 + boost: 20
41 +}]
15 42
16 const request = { 43 const request = {
17 config: { 44 config: {
18 encoding: encoding, 45 encoding: encoding,
19 sampleRateHertz: sampleRateHertz, 46 sampleRateHertz: sampleRateHertz,
20 - languageCode: languageCode 47 + languageCode: languageCode,
48 + alternativeLanguageCodes: ['en-US'],
49 + speechContexts: speechContexts
21 }, 50 },
22 interimResults: false, // If you want interim results, set this to true 51 interimResults: false, // If you want interim results, set this to true
23 }; 52 };
......