voice.getVoiceText - GiGAGenie-ServiceSDK/UserGuide GitHub Wiki

gigagenie.voice.getVoiceText

API ์„ค๋ช…

  • ์Œ์„ฑ ์ธ์‹ API
  • ์‚ฌ์šฉ์ž์—๊ฒŒ ์Œ์„ฑ ์•ˆ๋‚ด ํ›„ ์Œ์„ฑ ์ธ์‹์„ ์ง„ํ–‰
  • TTS ์ถœ๋ ฅ ์ค‘ stopTTS๋ฅผ ์ˆ˜์‹ ํ•˜๋ฉด TTS์™€ ์Œ์„ฑ์ธ์‹ ๋ชจ๋‘ ์ข…๋ฃŒ
  • ์Œ์„ฑ ์ธ์‹์ด ์ง„ํ–‰๋˜๋ฉด ํ•ด๋‹น ์Œ์„ฑ ์ธ์‹์„ ์ข…๋ฃŒํ•  ์ˆ˜ ์—†์Œ(Timeout์ฒ˜๋ฆฌ๋จ)
  • ํ•ด๋‹น API์˜ ttslanguage ์™€ voicelanguage ๋Š” ์…‹ํƒ‘ํ˜• ๋‹จ๋ง์—์„œ๋งŒ ์ง€์›๋จ(LTE ๋‹จ๋ง์—์„œ๋Š” ๋ฏธ์ง€์›)
  • * 1, 2๋ฒˆ ๋ชจ๋“œ ์„ค์ •์— ์•ž์„œ ๋‹ค์ด์–ผ๋กœ๊ทธ ํ‚ท์— ๋“ฑ๋ก๋œ ๋ฐœํ™”๊ฐ€ ์žˆ๋‹ค๋ฉด ๋‹ค์ด์–ผ๋กœ๊ทธ ํ‚ท ๋ฐœํ™”๋ฅผ ์šฐ์„  ์ฒ˜๋ฆฌํ•จ(onActionEvent ์ฐธ๊ณ )*

API ๊ตฌ์กฐ

  • function getVoiceText(options,callback)
  • options
    • mode: (Int, Optional) ์Œ์„ฑ ์ธ์‹ ๊ฒฐ๊ณผ์˜ ํ›„์ฒ˜๋ฆฌ๋ฅผ ์„ค์ •(default mode = 0)
      • 0: ์Œ์„ฑ ์ธ์‹ ๊ฒฐ๊ณผ๋ฅผ ์ „๋‹ฌ
      • 1: ์Œ์„ฑ ์ธ์‹ ๊ฒฐ๊ณผ๋ฅผ ๋Œ€ํ™” ์„œ๋ฒ„๋กœ ์ „๋‹ฌ(์Œ์„ฑ ์ธ์‹ ๊ฒฐ๊ณผ๋Š” undefined ๋กœ ์ „๋‹ฌ๋˜๋ฉฐ, ์ดํ›„ onActionEvent ๋กœ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์•ฑ์ด ์‹คํ–‰๋จ)
      • 2: ํ™•์ธ์— ๋Œ€ํ•œ ์Œ์„ฑ ์ธ์‹์„ ์ˆ˜ํ–‰
        • ์Œ์„ฑ ์ธ์‹ ๊ฒฐ๊ณผ๋Š” undefined๋กœ ์ „๋‹ฌ๋˜๋ฉฐ, onVoiceCommand๋กœ ํ™•์ธ์— ๋Œ€ํ•œ ์ธ์‹ ๊ฒฐ๊ณผ์ธ confirm, cancel ์„ ์ „๋‹ฌ
        • ๋‹จ, ํ™•์ธ์œผ๋กœ ํ•ด์„๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ๊ฒฐ๊ณผ๊ฐ€ ์ „๋‹ฌ๋˜์ง€ ์•Š์œผ๋ฉฐ ๊ทธ ๊ฒฝ์šฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Œ
          • ํ™•์ธ: "ํ™•์ธ", "๊ทธ๋ž˜", "์‘"์œผ๋กœ ๋ฐœํ™”ํ•œ ๊ฒฝ์šฐ
          • ์ทจ์†Œ: "์ทจ์†Œ", "์•„๋‹ˆ", "์•„๋‹ˆ์š”"๋กœ ๋ฐœํ™”ํ•œ ๊ฒฝ์šฐ
        • ๋ฒˆํ˜ธ ์„ ํƒ์— ๋Œ€ํ•œ ์Œ์„ฑ ์ธ์‹ ๊ฒฐ๊ณผ๋Š” undefined๋กœ ๋„˜๊ฒจ์ง€๋ฉฐ, ์ดํ›„ onSelectedNumber์— ์ธ์‹๋œ ๋ฒˆํ˜ธ๋ฅผ ์ „๋‹ฌํ•จ(๋ฒˆํ˜ธ๋Š” 1-6๋ฒˆ๊นŒ์ง€๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋ฉฐ ๋ฒˆํ˜ธ๊ฐ€ ์ธ์‹๋˜์ง€ ์•Š์œผ๋ฉด ๊ฒฐ๊ณผ๊ฐ€ ์ „๋‹ฌ๋˜์ง€ ์•Š์Œ)
    • voicemsg: (String, Optional) voicemsg ๋‚ด์šฉ์„ TTS๋กœ ์žฌ์ƒํ•œ ํ›„ ์Œ์„ฑ ์ธ์‹์„ ์‹œ์ž‘ํ•จ
    • ttslanguage: (Number, Optional) voicemsg๋ฅผ ์žฌ์ƒํ•  ์–ธ์–ด๋ฅผ ์„ค์ •(๊ธฐ๋ณธ ๊ฐ’์€ ํ•œ๊ตญ์–ด์ด๋ฉฐ, LTE ๋‹จ๋ง์—์„œ๋Š” ํ•œ๊ตญ์–ด๋งŒ ์ง€์›)
      • 0: ํ•œ๊ตญ์–ด ์„ค์ •(default)
      • 1: ์˜์–ด
      • 2: ์ค‘๊ตญ์–ด
      • 3: ์ผ๋ณธ์–ด
    • voicelanguage: (Number, Optional) ์Œ์„ฑ ์ธ์‹์—์„œ ์‚ฌ์šฉํ•  ์–ธ์–ด๋ฅผ ์„ค์ •(๊ธฐ๋ณธ ๊ฐ’์€ ํ•œ๊ตญ์–ด, LTE ๋‹จ๋ง์—์„œ๋Š” ํ•œ๊ตญ์–ด๋งŒ ์ง€์›)
      • 0: ํ•œ๊ตญ์–ด ์„ค์ •(default)
      • 1: ์˜์–ด
      • 2: ์ค‘๊ตญ์–ด
      • 3: ์ผ๋ณธ์–ด
    • timeout: (Number, Optional) ์Œ์„ฑ ์ธ์‹ ๋Œ€๊ธฐ ์‹œ๊ฐ„(์ดˆ)์„ ์„ค์ • (default 7์ดˆ, ์ตœ๋Œ€ 7์ดˆ ์ดํ•˜๋งŒ ์ง€์›ํ•˜๋ฉฐ voicemsg ์žฌ์ƒ ์ข…๋ฃŒ ์ดํ›„๋ถ€ํ„ฐ count)
    • text: (String, Optional) ์Œ์„ฑ ์ธ์‹์˜ ์ •ํ™•๋„๋ฅผ ๊ณ„์‚ฐํ•˜๊ธฐ ์œ„ํ•ด ์ธ์‹๋˜์–ด์•ผ ํ•˜๋Š” Text (์˜์–ด๋งŒ ์ง€์›)
  • result_cd
    • 200: ์Œ์„ฑ์ธ์‹ ์„ฑ๊ณต, extra.voicetext ์— ์ธ์‹๋œ ๊ฒฐ๊ณผ๊ฐ€ ์ „๋‹ฌ๋จ
    • 500: Timeout ๋ฐœ์ƒ ๋“ฑ์œผ๋กœ ์Œ์„ฑ ์ธ์‹ ์‹คํŒจ(extra.voicetext ์—๋Š” ASR session timeout์„ ์ „๋‹ฌ)
    • 501: KWS(KeyWord Spotting)์— ์˜ํ•ด ์ •์ง€๋จ
    • 502: ์žฌ์ƒ ์‹คํŒจ
    • 503: stopTTS์— ์˜ํ•œ TTS ์ข…๋ฃŒ
    • 504: mute ์ƒํƒœ๋กœ TTS ์žฌ์ƒ ๋ถˆ๊ฐ€
    • 505: ์ฒ˜๋ฆฌ ์šฉ๋Ÿ‰ ์ดˆ๊ณผ(๋‹ค๊ตญ์–ด ์Œ์„ฑ์ธ์‹ ์ค‘ ์„œ๋ฒ„ ์šฉ๋Ÿ‰ ์ดˆ๊ณผ์‹œ ๋ฐœ์ƒ)
  • extra
    • voicetext: (String, Mandatory) ์Œ์„ฑ ์ธ์‹๋œ Text๋ฅผ ์ „๋‹ฌ
    • accuracy: (Number, Optional) ์Œ์„ฑ ์ธ์‹ ๊ฒฐ๊ณผ์˜ ์ •ํ™•๋„(options.text ๊ฐ€ ์„ค์ •๋˜์–ด ์žˆ๊ณ , options.voicelanguage ๊ฐ€ 1์ธ ๊ฒฝ์šฐ์—๋งŒ ์„ค์ •๋˜์–ด ๋ฆฌํ„ด๋จ)

์‚ฌ์šฉ ์˜ˆ์‹œ

// callback ๋ฐฉ์‹์œผ๋กœ, ์ฆ‰์‹œ ์Œ์„ฑ ์ธ์‹์„ ํ•  ๊ฒฝ์šฐ
gigagenie.voice.getVoiceText(null, function (result_cd, result_msg, extra) {
    if (result_cd === 200) {
        console.log("Received Text is " + extra.voicetext);
    };
});
// callback ๋ฐฉ์‹์œผ๋กœ, TTS ์žฌ์ƒ ํ›„ ์Œ์„ฑ ์ธ์‹์„ ํ•  ๊ฒฝ์šฐ
var options = {};
options.voicemsg = "์ƒ๋…„์›”์ผ์„ ๋งํ•ด ์ฃผ์„ธ์š”"
gigagenie.voice.getVoiceText(options, function (result_cd, result_msg, extra) {
    if (result_cd === 200) {
        console.log("Received Text is " + extra.voicetext);
    };
});

ํ™œ์šฉ ์˜ˆ์ œ๋Š” (GiGA Genie ๊ตฌ๊ตฌ๋‹จ)์—์„œ ํ™•์ธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค