Webã¢ããªã±ãŒã·ã§ã³ã®éçºäžã«ãããŸããŸãªã°ã©ãã£ã«ã«ã³ã³ãããŒã«ã䜿çšããŠããŠãŒã¶ãŒã€ã³ã¿ã©ã¯ã·ã§ã³ãæŽçã§ããŸãã Web Speech APIã䜿çšãããšãæå°éã®èŠèŠçã€ã³ã¿ãŒãã§ãŒã¹ã§ã人éãšèªç¶ã®é³å£°éä¿¡æ¹æ³ãã¢ããªã±ãŒã·ã§ã³ã«çµ±åã§ããŸãã ããã°ã©ã ã®æ©èœã匷åããæ°ãããã¯ãããžãŒãé©çšããããã®ç¡æ°ã®ãªãã·ã§ã³ããããŸãã ããã«ãWeb Speech APIã䜿çšãããšã身äœé害ãŸãã¯èªç¥é害ãŸãã¯æªæã®ãã人ã«ãšã£ãŠãWebã¢ããªã±ãŒã·ã§ã³ã§ã®äœæ¥ããã䟿å©ã«ãªããŸãã ãããã£ãŠãå°æ¥ã®ãŠã§ã空éã¯ããã瀟亀çã§ã¢ã¯ã»ã¹ãããããã®ã«ãªãã§ãããã
Web Speech APIã䜿çšãããšãWebãµã€ãããã³Webã¢ããªã±ãŒã·ã§ã³ã¯ãŠãŒã¶ãŒã«è©±ãã ãã§ãªãããŠãŒã¶ãŒã®ã¹ããŒããç¥èŠããããšãã§ããŸãã ããã䜿çšããŠãããã°ã©ã ã人éãšå¯Ÿè©±ããèœåã匷åããæ¹æ³ã®å°ãªããšãããã€ãã®åªããäŸãèŠãŠãã ããã
ä»æ¥ã¯ãWeb Speech APIã䜿çšããŠãã€ã³ããªãžã§ã³ããªãã©ãŠã¶ããŒã¹ã®ãã€ã¹ãã£ãããäœæããæ¹æ³ã«ã€ããŠèª¬æããŸãã ããã°ã©ã ã¯ãŠãŒã¶ãŒã®å£°ãèãã圌ã®çºèšã«åæé³å£°ã§å¿çããŸãã Web Speech APIã¯ãŸã å®éšçã§ãããããã¢ããªã±ãŒã·ã§ã³ã¯ãã®APIããµããŒããããã©ãŠã¶ãŒã§ã®ã¿åäœããŸãã
ãã®è³æã§äœ¿çšãããŠããé³å£°èªèãšé³å£°åæã®äž¡æ¹ã®æ©èœã¯ãChrome 25+ããã³Opera 27+ãªã©ã®ChromiumããŒã¹ã®ãã©ãŠã¶ãŒã®ã¿ããµããŒãããFirefoxãEdgeããã³Safariã¯é³å£°åæã®ã¿ããµããŒãããŸãã
ããŸããŸãªãã©ãŠã¶ã§ã®åæããã³é³å£°èªèã®ãµããŒã
ããããäœæãããã®ãChromeã§ã©ã®ããã«æ©èœãããã瀺ããããªã次ã«ç€ºããŸãã
Webã¢ããªã±ãŒã·ã§ã³ã§ã®äœæ¥ã¯ã3ã€ã®äž»èŠãªã¹ãããã§æ§æãããŠããŸãã
- Web Speech APIã®
SpeechRecognition
ã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããŠããŠãŒã¶ãŒã®é³å£°ããã°ã©ã ã®ç¥èŠãæŽçããŸãã
- ãŠãŒã¶ãŒã®çºèšãããã¹ãã«å€æããåçšã®èªç¶èšèªåŠçAPIïŒãã®å Žåã¯API.AIïŒã«ãªã¯ãšã¹ããéä¿¡ããŸãã
- API.AIããå¿çãåä¿¡ãã
SpeechSynthesis
ã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããŠã¹ã³ã¢ãªã³ã°ããŸãã
ã¢ããªã±ãŒã·ã§ã³ãšãŠãŒã¶ãŒããã³å€éšãµãŒãã¹ãšã®çžäºäœçšã®ã¹ããŒã
ããã§äœæãããã®ã®å®å šãªãœãŒã¹ã³ãŒãã¯ãGitHubã«ãããŸãã
ãã®ãã¥ãŒããªã¢ã«ã¯Node.jsã«åºã¥ããŠããŸãã ããŸã察åŠããã«ã¯ãJavaScriptãç解ããNode.jsã®åºæ¬ãç解ããå¿ èŠããããŸãã Nodeãã€ã³ã¹ããŒã«ãããŠãããéå§ã§ãããã©ããã確èªããŸãã
Node.jsã¢ããªã±ãŒã·ã§ã³ã®æºå
ãŸããNode.jsã¢ããªã±ãŒã·ã§ã³ã®ãã¬ãŒã ã¯ãŒã¯ãæºåããŸãã ãã©ã«ããŒãäœæãã次ã®ãã©ã«ããŒãé 眮ããŸãã
. âââ index.js âââ public â âââ css â â âââ style.css â âââ js â âââ script.js âââ views âââ index.html
次ã«ããã®ã³ãã³ããå®è¡ããŠã¢ããªã±ãŒã·ã§ã³ãåæåããŸãã
$ npm init -f
-f
䜿çšãããšãããã©ã«ãèšå®ãé©çšã§ããŸããããã®ã¹ã€ããã䜿çšããã«ã¢ããªã±ãŒã·ã§ã³ãæåã§æ§æã§ããŸãã åæåäžã«ãã¢ããªã±ãŒã·ã§ã³ã«é¢ããåºæ¬æ å ±ãå«ã
package.json
ãã¡ã€ã«ãäœæãããŸãã
次ã«ãããã°ã©ã ã®ãã«ãã«å¿ èŠãªäŸåé¢ä¿ãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã
$ npm install express socket.io apiai --save
--save
ãã©ã°ã䜿çšãããšã
package.json
ãã¡ã€ã«ãèªåçã«æŽæ°ãããŸãã äŸåé¢ä¿æ å ±ãè¿œå ãããŸãã
Expressã䜿çšããŸããããã¯ãããŒã«ã«ãµãŒããŒã§å®è¡ãããNode.jsã¢ããªã±ãŒã·ã§ã³ã®ãµãŒããŒåŽãã¬ãŒã ã¯ãŒã¯ã§ãã ãµãŒããŒãšã¯ã©ã€ã¢ã³ãéã®åæ¹åã®ããŒã¿äº€æããªã¢ã«ã¿ã€ã ã§æŽçããããã«ã Socket.IOã䜿çšããŸã ã ããã«ã API.AIèªç¶èšèªåŠçãµãŒãã¹ãšå¯Ÿè©±ããããã®ããŒã«ãã€ã³ã¹ããŒã«ããŸãã ããã«ããã人ãšã®äŒè©±ãç¶æã§ããã€ã³ããªãžã§ã³ããªãã£ããããããäœæã§ããŸãã
Socket.IOã¯ãNode.jsã§WebSocketsãã¯ãããžãŒã®äœ¿çšãç°¡çŽ åããã©ã€ãã©ãªã§ãã ã¯ã©ã€ã¢ã³ããšãœã±ããããŒã¹ã®ãµãŒããŒéã§æ¥ç¶ã確ç«ãããåŸããããã®éã®ã¡ãã»ãŒãžã¯éåžžã«è¿ éã«éä¿¡ãããŸãã ã€ãŸããããã¯ãWeb Speech APIããŠãŒã¶ãŒã®ãã¬ãŒãºãããã¹ãã¡ãã»ãŒãžã«å€æããç¬éã«ã¯ã©ã€ã¢ã³ãåŽã§ã人工ç¥èœã®å¿çããã¹ããAPI.AIããæ¥ããšãã«ãµãŒããŒåŽã§çºçããŸãã
index.js
ãã¡ã€ã«ãäœæããExpressã€ã³ã¹ã¿ã³ã¹ãæºåããŠãæ¥ç¶ãåŸ ã¡ãŸãã
const express = require('express'); const app = express(); app.use(express.static(__dirname + '/views')); // html app.use(express.static(__dirname + '/public')); // js, css, images const server = app.listen(5000); app.get('/', (req, res) => { res.sendFile('index.html'); });
次ã«ãã·ã¹ãã ã®ã¯ã©ã€ã¢ã³ãéšåã§äœæ¥ããŸãããã 次ã®ã¹ãããã§ã¯ãWeb Speech APIãã¢ããªã±ãŒã·ã§ã³ã€ã³ã¿ãŒãã§ã€ã¹ã«çµ±åããŸãã
SpeechRecognitionã«ããé³å£°èªè
Web Speech APIã«ã¯SpeechRecognitionãšããã¡ã€ã³ã³ã³ãããŒã©ãŒã€ã³ã¿ãŒãã§ã€ã¹ããããŸãã ãŠãŒã¶ãŒããã€ã¯ã«åãã£ãŠèšã£ãããšãããã¹ãã«å€æã§ããŸãã
ãã®ã¢ããªã±ãŒã·ã§ã³ã®ãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ã¯éåžžã«ã·ã³ãã«ã§ãã ãã®äž»ãªèŠçŽ ã¯ãã¿ã³ã§ãã¯ãªãã¯ãããšé³å£°èªèãéå§ãããŸãã
index.html
ãã¡ã€ã«ãèšå®ãããã¡ã€ã«ãã¯ã©ã€ã¢ã³ãã¹ã¯ãªããïŒ
script.js
ïŒããã³Socket.IOã©ã€ãã©ãªã«æ¥ç¶ããŸããããã¯åŸã§ãµãŒããŒãšããŒã¿ã亀æããããã«äœ¿çšããŸãã
<html lang="en"> <head>âŠ</head> <body> ⊠<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.1/socket.io.js"></script> <script src="js/script.js"></script> </body> </html>
HTMLããã¥ã¡ã³ãã®æ¬æã«ãã¿ã³ãè¿œå ããŸãã
<button>Talk</button>
ãã¿ã³ã®ã¹ã¿ã€ã«ãèšå®ããããã«ã
style.css
ãã¡ã€ã«ã
style.css
ãŸã; ãµã³ãã«ã³ãŒãã«ãããŸã ã
JavaScriptã䜿çšããé³å£°ãã£ããã£
script.js
ã§ã¯ãé³å£°èªèã®ããã«ãWeb Speech APIããSpeechRecognitioné³å£°èªèãµãŒãã¹ã³ã³ãããŒã©ãŒã€ã³ã¿ãŒãã§ã€ã¹ã®ã€ã³ã¹ã¿ã³ã¹ãäœæããŸãã
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; const recognition = new SpeechRecognition();
ããã§ã¯ããã¬ãã£ãã¯ã¹ãä»ããŠãããªããžã§ã¯ããšä»ããŠããªããªããžã§ã¯ãã®ååã䜿çšããŸã
webkit
ã¯ã
webkit
ãã¬ãã£ãã¯ã¹ãæã€ããŒãžã§ã³ã§ã®ã¿å¿ èŠãªAPIããµããŒãããããã«ãªã£ãããã§ãã
ããã«ãECMAScript6æ§æã䜿çšããŸãã
const
ããŒã¯ãŒããšç¢å°é¢æ°ã®ãµããŒããå«ãŸããŠããŸãã ããã¯ãã¹ãŠã
SpeechRecognition
ãš
SpeechSynthesis
äž¡æ¹ã®Speech APIããµããŒããããã©ãŠã¶ã§å©çšã§ããŸãã
å¿ èŠã«å¿ããŠã察å¿ãããªããžã§ã¯ãã®ããŸããŸãªããããã£ãèšå®ããããšã«ãããé³å£°èªèãæ§æã§ããŸãã 次ã®èšå®ãé©çšããŸãã
recognition.lang = 'en-US'; recognition.interimResults = false;
次ã«ããã¿ã³ãžã®ãªã³ã¯ãå¿ èŠã§ãã ã¯ãªãã¯ããã€ãã³ãããªãã¹ã³ããŸããããã¯ãé³å£°èªèããã»ã¹ãéå§ããããã«äœ¿çšãããŸãã
èªèãéå§ããåŸããŠãŒã¶ãŒãèšã£ãããšã®ããã¹ãè¡šçŸãååŸããããã«
result
ã€ãã³ãã䜿çšããŸãã
recognition.addEventListener('result', (e) => { let last = e.results.length - 1; let text = e.results[last][0].transcript; console.log('Confidence: ' + e.results[0][0].confidence); // Socket.IO });
ããã§ã¯ãé³å£°èªèã®çµæãå«ã
SpeechRecognitionResultList
ãªããžã§ã¯ãã«é¢å¿ããããŸãã ããã¹ãã¯ã察å¿ããé åããæœåºã§ããŸãã ããã«ãã芧ã®ãšãããããã§ã¯åä¿¡ããããã¹ãã®
confidence
ã€ã³ãžã±ãŒã¿ãŒãã³ã³ãœãŒã«ã«è¡šç€ºããŸãã
次ã«ãSocket.IOã䜿çšããŠããŒã¿ããµãŒããŒã³ãŒãã«è»¢éããŸãã
Socket.IOã䜿çšãããªã¢ã«ã¿ã€ã ããŒã¿äº€æ
Socket.IOã¯ããªã¢ã«ã¿ã€ã Webã¢ããªã±ãŒã·ã§ã³çšã«èšèšãããã©ã€ãã©ãªã§ãã ããã«ãããã·ã¹ãã ã®ã¯ã©ã€ã¢ã³ãéšåãšãµãŒããŒéšåã®éã§åæ¹åã®ããŒã¿äº€æãæŽçã§ããŸãã ãã®ã©ã€ãã©ãªã䜿çšããŠãèªèãããé³å£°ã®ããã¹ãè¡šçŸãNode.jsãµãŒããŒã§å®è¡ãããŠããã³ãŒãã«éä¿¡ãããµãŒããŒã®å¿çããã©ãŠã¶ãŒã«éä¿¡ããŸãã
åçŽãªHTTPãŸãã¯AJAXãªã¯ãšã¹ãã䜿çšããŠããªãçç±ãçåã«æããããããŸããã ããšãã°ãPOSTèŠæ±ã䜿çšããŠãããŒã¿ããµãŒããŒã«éä¿¡ã§ããŸãã ãã ããSocket.IOãä»ããŠWebSocketã䜿çšããŸããããã¯ãç¹ã«ãµãŒããŒãããã©ãŠã¶ãŒã«ã€ãã³ããéä¿¡ãããå Žåã«ãåæ¹å亀æãæŽçããããã®æãæåãããœãªã¥ãŒã·ã§ã³ã§ããããã§ãã ãœã±ããããŒã¹ã®åžžææ¥ç¶ã«ããããã©ãŠã¶ã§ããŒã¿ããªããŒãããããAJAXãªã¯ãšã¹ããéä¿¡ãããããå¿ èŠã¯ãããŸããã
ã¯ã©ã€ã¢ã³ãããµãŒããŒããµãŒãããŒãã£ã®èªç¶èšèªåŠçãµãŒãã¹éã®çžäºäœçšã®ã¹ããŒã
ã¯ã©ã€ã¢ã³ãã®
script.js
ãã¡ã€ã«ã§ã
script.js
ã®ã€ã³ã¹ã¿ã³ã¹ãäœæããŸãã
const socket = io();
次ã«ã
SpeechRecognition
ããã®
result
ã€ãã³ããåŠçããå Žæã«æ¬¡ã®ã³ãŒããè¿œå ããŸãã
socket.emit('chat message', text);
ããã§ã¯ãã¢ããªã±ãŒã·ã§ã³ã®ãµãŒããŒåŽã«ç§»ããŸãããã 圌女ã¯ã¯ã©ã€ã¢ã³ãããéä¿¡ãããããã¹ããåä¿¡ãã人工ç¥èœã®æ©èœãå®è£ ãããµãŒãããŒãã£ã®ãµãŒãã¹ã«è»¢éããå¿ èŠããããŸãã ãµãŒããŒã¯ããµãŒãã¹ããå¿çãåä¿¡ããåŸããããã¯ã©ã€ã¢ã³ãã«éä¿¡ããå¿ èŠããããŸãã
å€éšãµãŒãã¹ããã®å¿çãåä¿¡ãã
å€ãã®ãã©ãããã©ãŒã ãšãµãŒãã¹ã«ãããé³å£°ããããã¹ããžã®å€æãšèªç¶èšèªåŠçã䜿çšããŠãã¢ããªã±ãŒã·ã§ã³ã人工ç¥èœã·ã¹ãã ãšçµ±åã§ããŸãã ãã®äžã«ã¯ã IBM Watson ã Microsoft LUIS ãããã³Wit.aiããããŸãã é³å£°ã€ã³ã¿ãŒãã§ã€ã¹ããã°ããæ§ç¯ããã«ã¯ã API.AIã䜿çšããŸãã ããã§ã¯ãç¡æã®éçºè ã¢ã«ãŠã³ããååŸãããµãŒãã¹ã®Webã€ã³ã¿ãŒãã§ã€ã¹ãšNode.jsã®ã©ã€ãã©ãªã䜿çšããŠãç°¡åãªãã£ãããããã®ã³ã¢ããã°ããã»ããã¢ããã§ããŸãã
ã¢ã«ãŠã³ããäœæãããããšãŒãžã§ã³ããäœæããŸãã ããã«ã€ããŠã¯ã å ¥éã¬ã€ãã®åé ã§èªãããšãã§ããŸãã å®å šãªã«ã¹ã¿ãã€ãºã«ã¯ããšã³ãã£ãã£ã®äœæãšããŠãŒã¶ãŒã話ããã¬ãŒãºãšã·ã¹ãã ãå®è¡ããã¢ã¯ã·ã§ã³ãšã®é¢ä¿ã®ã«ã¹ã¿ãã€ãºãå«ãŸããŸãã Small Talkããªã»ããã䜿çšããŠãããè¡ãããšã¯ãããŸããã å·Šã®ã¡ãã¥ãŒã§ãã®é ç®ãéžæããã¹ã€ããã䜿çšããŠãµãŒãã¹ãæå¹ã«ããå¿ èŠããããŸãã
API.AIã§Small Talkãæ§æãã
ããã«ãAPI.AIã€ã³ã¿ãŒãã§ãŒã¹ã䜿çšããŠããšãŒãžã§ã³ããæ§æããŸãã ãšãŒãžã§ã³ãåã®æšªã«ããæ¯è»ã®ã¢ã€ã³ã³ãã¯ãªãã¯ããŠ[å šè¬èšå®]ããŒãžã«ç§»åããAPIããŒãååŸããŸãã ããã§ãã¯ã©ã€ã¢ã³ãã¢ã¯ã»ã¹ããŒã¯ã³ããšåŒã°ãããã®ãã€ãŸããµãŒãã¹ã®ã¢ã¯ã»ã¹ããŒã¯ã³ãå¿ èŠã«ãªããŸãã Node.js SDKã§ãã®ããŒã¯ã³ã䜿çšããŸãã
Node.jsçšSDK API.AIã®äœ¿çš
é©åãªSDKã䜿çšããŠãNode.jsã¢ããªã±ãŒã·ã§ã³ãAPI.AIã«æ¥ç¶ããŸãã
index.js
ãã¡ã€ã«
index.js
ãã¢ã¯ã»ã¹ããŒã¯ã³ã䜿çšããŠAPI.AIãåæåããŸãã
const apiai = require('apiai')(APIAI_TOKEN);
ã³ãŒããããŒã«ã«ã§ã®ã¿å®è¡ããå Žåã¯ãããã«APIããŒã¯ã³ãå ¥åããã ãã§ãã ãã以å€ã®å Žåã¯ãç°å¢å€æ°ã«ä¿åããããšããå§ãããŸãã ç°å¢å€æ°ãèšå®ããã«ã¯å€ãã®æ¹æ³ããããŸããéåžžã察å¿ããããŒã¿ã
.env
ãã¡ã€ã«ã«æžã蟌ã¿ãŸãã GitHubã«æçš¿ãããã³ãŒãã«ã¯ã
.gitignore
å«ãŸããŠããããããã®ãã¡ã€ã«ã¯ãããŸããã ãããã®ãã¡ã€ã«ãã©ã®ããã«æ©èœããããç¥ãããå Žåã¯ã
.env-test
ãã¡ã€ã«ãèŠãŠãã ãã ã
ãã®ããããµãŒããŒäžã§Socket.IOã䜿çšããŠããã©ãŠã¶ãŒããé³å£°èªèçµæãååŸããŸãã æ¥ç¶ã確ç«ãããã¡ãã»ãŒãžããµãŒããŒã«é ä¿¡ããããšããã«ãAPI.AIã®æ©èœã䜿çšããŠããŠãŒã¶ãŒã®ã¹ããŒãã¡ã³ãã«å¯Ÿãããããã®å¿çãååŸããŸãã
io.on('connection', function(socket) { socket.on('chat message', (text) => { // API.AI let apiaiReq = apiai.textRequest(text, { sessionId: APIAI_SESSION_ID }); apiaiReq.on('response', (response) => { let aiText = response.result.fulfillment.speech; socket.emit('bot reply', aiText); // Send the result back to the browser! }); apiaiReq.on('error', (error) => { console.log(error); }); apiaiReq.end(); }); });
API.AIãçµæãè¿ããšããsocket.emit
socket.emit()
Socket.IOã¡ãœããã䜿çšããŠããŒã¿ããã©ãŠã¶ã«éä¿¡ããŸãã
SpeechSynthesis-ãããã®å£°
ã¢ããªã±ãŒã·ã§ã³ã§ã®äœæ¥ãå®äºããããã«ãã¯ã©ã€ã¢ã³ãã®
script.js
ãã¡ã€ã«ã«
script.js
ãŸãã
é³å£°åæçšã®é¢æ°ãäœæããŸãã ããã§ã¯ãWeb Speech APIã®
SpeechSynthesis
ã³ã³ãããŒã©ãŒ
SpeechSynthesis
ã䜿çšããŸãã
é¢æ°ã¯åŒæ°ãšããŠæååãåãããã®åŸãã·ã¹ãã ã¯ãã®æååããããã¹ããçºé³ããŸãã
function synthVoice(text) { const synth = window.speechSynthesis; const utterance = new SpeechSynthesisUtterance(); utterance.text = text; synth.speak(utterance); }
ãã®é¢æ°ã§ã¯ãæåã«APIãšã³ããªãã€ã³ã
window.speechSynthesis
ãžã®ãªã³ã¯ãäœæããŸãã ä»åã¯ãã¬ãã£ãã¯ã¹ä»ãã®ããããã£ã䜿çšããŠããªãããšã«æ°ä»ããããããŸããã å®éããã®APIã®ãµããŒãã¯
SpeechRecognition
ãµããŒããããåºãããã®APIããµããŒããããã¹ãŠã®ãã©ãŠã¶ãŒã¯
SpeechSynthesis
ã®ãã¬ãã£ãã¯ã¹ãæ¢ã«åé€ããŠããŸãã
次ã«ãã³ã³ã¹ãã©ã¯ã¿ãŒã䜿çšããŠãæ°ããSpeechSynthesisUtteranceïŒïŒãªããžã§ã¯ããäœæããŸãã 次ã«ã
utterance
ãªããžã§ã¯ãã®
text
ããããã£ãèšå®ã
text
ã ãã®ããããã£ã«æ£ç¢ºã«æžãçãããã®ã¯ããã·ã³ã«ãã£ãŠçºé³ãããŸãã ããã§ãä»ã®ãããã㣠ãããšãã°
voice
ããããã£ãèšå®ããŠãé³å£°ã®çš®é¡ãéžæã§ããŸãã
æåŸã«ã
SpeechSynthesis.speak()
åŒã³åºãã䜿çšããŸããããã«ãããã³ã³ãã¥ãŒã¿ãŒããã¬ãŒãºãçºé³ããŸãã
ããã§ãåã³Socket.IOã䜿çšããŠããµãŒããŒããå¿çãååŸããŸãã ã¡ãã»ãŒãžãåä¿¡ãããšããã«ãäžèšã®é¢æ°ãåŒã³åºããŸãã
socket.on('bot reply', function(replyText) { synthVoice(replyText); });
ã¹ããŒããã£ãããããã§ãã£ããã§ããããã«ãªããŸããïŒ
ãã£ããããããã£ãã
åããŠããã°ã©ã ãšéä¿¡ããããšãããšããã©ãŠã¶ãããã€ã¯ã®äœ¿çšèš±å¯ãæ±ããããããšã«æ³šæããŠãã ããã ä»ã®APIïŒãžãªãã±ãŒã·ã§ã³ãéç¥ïŒãšåæ§ã«ããã©ãŠã¶ãŒã¯æ©å¯ããŒã¿ãæäœããåã«èš±å¯ãèŠæ±ããŸãã ãã®çµæãããªãã®å£°ã¯ããªãã®ç¥ããªããã¡ã«é²é³ãããŸããã
ãã®ããããšãã°ãããã£ãããããšãããã§äœ¿çšãããAIãéåžžã«åçŽãªã®ã§ããã®ãã£ããã«é£œããŠããŸããŸãã ãã ããAPI.AIã«åºã¥ããŠæ§ç¯ããããããã¯æ§æããã³ãã¬ãŒãã³ã°ã§ããŸãã API.AI ããã¥ã¡ã³ããèªã¿ããã®ã€ã³ããªãžã§ã³ã¹ã«åãçµãããšã§ãããããããã¹ããŒãã«ã§ããŸãã
ãã®ã¬ã€ãã§ã¯ãæ°ããAPIã®äž»ãªæ©èœã®ã¿ãåãäžããŠããŸãããå®éã«ã¯éåžžã«æè»æ§ãé«ããå€ãã®èšå®ããµããŒãããŠããããšã«æ³šæããŠãã ããã é³å£°èªèãšåæã®èšèªãã¢ã¯ã»ã³ãïŒããšãã°ãã¢ã¡ãªã«è±èªãšã€ã®ãªã¹è±èªïŒãå«ãåæé³å£°ãé³å£°ããããåèªã®çºé³é床ãå€æŽã§ããŸãã 以äžã«ãWeb Speech APIã®è©³çŽ°ãåŠã¶ã®ã«åœ¹ç«ã€äŸ¿å©ãªãªã³ã¯ã瀺ããŸãã
- Web Speech API ïŒMozilla Developer NetworkïŒ
- Web Speech APIä»æ§ ïŒW3CïŒ
- Web Speech APIïŒé³å£°åæ ïŒMicrosoftïŒ
Node.jsããã³ããã§äœ¿çšããã©ã€ãã©ãªã«é¢ããæçšãªè³æã次ã«ç€ºããŸãã
- Node.jsã¬ã€ã
- Npmããã¥ã¡ã³ã
- Expressã®ãHello Worldã ã
- Socket.IOã§å§ããŸããã ã
æåŸã«ãèªç¶èšèªãåŠçããããã®ããŸããŸãªããŒã«ãšãã³ã³ãã¥ãŒã¿ãŒãšã®éä¿¡ãæŽçããããã®ãã©ãããã©ãŒã ãèŠãŠã¿ãŸãããã
- API.AI ïŒGoogleïŒ
- Wit.ai ïŒFacebookïŒ
- LUIS ïŒMicrosoftïŒ
- ã¯ããœã³ ïŒIBMïŒ
- ã¬ãã¯ã¹ ïŒAmazonïŒ
æŠèŠïŒWebã®æªæ¥ãžã®äžæ©
GoogleãFacebookãMicrosoftãIBMãããã³Amazonãèªç¶èšèªãåŠçãããã©ãããã©ãŒã ã®éçºè ã®ãªã¹ãã«èŒã£ãŠããããšã¯å¶ç¶ã§ã¯ãããŸããã ããã¯ãWebã®æªæ¥ãé³å£°ã€ã³ã¿ãŒãã§ã€ã¹ã«ãšã£ãŠå¯äžã®ãã®ã§ããããšãæå³ããŸããïŒ ãããããããå®å šã«ç¢ºå®ã«è¿°ã¹ãããšã¯ã§ããŸããã ãã ããããã¯ããã®ãããªã€ã³ã¿ãŒãã§ã€ã¹ãã¢ãã€ã«ãã©ãããã©ãŒã ã§éåžžã«äººæ°ããããšããäºå®ãšåæ§ã«ãWebã¢ããªã±ãŒã·ã§ã³ã§å ŽæãèŠã€ããããšã瀺åããŠããŸãã é³å£°æè¡ãšäººå·¥ç¥èœã¯ãWebã³ã³ãã³ããæäœããéåžžã®æ¹æ³ãè£å®ããã€ã³ã¿ãŒãããããã䟿å©ã§æé ãªäŸ¡æ Œã«ããŸãã
é³å£°Webãã¯ãããžãŒã«é¢ããã¹ããŒãªãŒãã楜ãã¿ããã ããèå³æ·±ãä»®æ³äŒè©±ããŒãããŒãäœæããŠãã ããã
芪æãªãèªè ïŒ Webã¢ããªã±ãŒã·ã§ã³ã§é³å£°èªèããã³é³å£°åææè¡ã䜿çšããæ¹æ³ã®ãã¡ãæãèå³æ·±ããææãªãã®ã¯äœã§ããïŒ