【浏览器】Artyom:打造个人语音助手

Github:Artyom 

HTML内容

需要引入jquery和artyom.window.js

使用方法:打开浏览器,提示你打开麦克风。然后单击按钮,自动会说Master!你说hello,她会问你干啥。

其他命令自己写。



<!DOCTYPE html>
<!-- saved from url=(0060)https://sdkcarlos.github.io/demos/ourcodeworld-artyomjs.html -->
<html lang="zh-CN" class="translated-ltr">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="Our Code World">
  <script src="jquery-3.6.0.min.js"></script>
  <script src="artyom.window.js"></script>
  <title>语音助手测试</title>



<body>
  <button id="speak" style="width: 100px;height: 50px;">Speak</button>
  <script>
    const artyom = new Artyom();
    document.getElementById("speak").addEventListener("click",
      function () {
        artyom.say("What can i do for you")
      }, false)

    artyom.addCommands([{
      indexes: ["hello", "hi", "hey"],
      action: (i) => {
        artyom.say("My Master,I'm here")
      }
    }, {
      indexes: ["Shutdown"],
      action: (i, wildcard) => {
        artyom.fatality().then(() => {
          console.log("11")
        });
      }
    }]);

    artyom.initialize({
      lang: "en-GB",
      continuous: true,
      soundex: true,
      debug: true,
      executionKeyword: "and do it now",
      listen: true

    }).then(() => {
      console.log("success")
    }).catch(err => {
      console.log("err")
    });
  </script>
</body>

</html>

 

给TA充电
共{{data.count}}人
人已充电
编程

【书籍知识点归纳】高性能JavaScript

2021-12-6 1:40:33

编程

JavaScript 对象继承

2021-12-16 11:28:56

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
搜索