如何构建一个简单的语音识别应用程序

“In this 10-year time frame, I believe that we’ll not only be using the keyboard and the mouse to interact but during that time we will have perfected speech recognition and speech output well enough ...
摘要由CSDN通过智能技术生成
“In this 10-year time frame, I believe that we’ll not only be using the keyboard and the mouse to interact but during that time we will have perfected speech recognition and speech output well enough that those will become a standard part of the interface.” — Bill Gates, 1 October 1997
“在这十年的时间里,我相信我们不仅将使用键盘和鼠标进行交互,而且在这段时间内,我们将充分完善语音识别和语音输出,使它们将成为语音识别的标准部分。接口。” —比尔·盖茨,1997年10月1日

Technology has come a long way, and with each new advancement, the human race becomes more attached to it and longs for these new cool features across all devices.

技术已经走了很长一段路,并且随着每一项新的进步,人类变得对它越来越依赖,并且渴望在所有设备上拥有这些新的酷功能。

With the advent of Siri, Alexa, and Google Assistant, users of technology have yearned for speech recognition in their everyday use of the internet. In this post, I’ll be covering how to integrate native speech recognition and speech synthesis in the browser using the JavaScript WebSpeech API.

随着Siri,Alexa和Google Assistant的出现,技术用户已经渴望在日常使用互联网时进行语音识别。 在本文中,我将介绍如何使用JavaScript WebSpeech API在浏览器中集成本机语音识别和语音合成。

According to the Mozilla web docs:

根据Mozilla网络文档:

The Web Speech API enables you to incorporate voice data into web apps. The Web Speech API has two parts: SpeechSynthesis (Text-to-Speech), and SpeechRecognition (Asynchronous Speech Recognition.)
Web Speech API使您可以将语音数据合并到Web应用程序中。 Web语音API有两个部分:语音合成(文本到语音)和语音识别(异步语音识别)。

我们将需要构建我们的应用程序的要求 (Requirements we will need to build our application)

For this simple speech recognition app, we’ll be working with just three files which will all reside in the same directory:

对于这个简单的语音识别应用程序,我们将仅处理三个文件,它们都位于同一目录中:

  • index.html containing the HTML for the app.

    index.html其中包含应用程序HTML。

  • style.css containing the CSS styles.

    包含CSS样式的style.css

  • index.js containing the JavaScript code.

    包含JavaScript代码的index.js

Also, we need to have a few things in place. They are as follows:

另外,我们需要准备一些东西。 它们如下:

  • Basic knowledge of JavaScript.

    JavaScript的基础知识。
  • A web server for running the app. The Web Server for Chrome will be sufficient for this purpose.

    用于运行应用程序的Web服务器。 ChromeWeb服务器 为此目的就足够了。

设置我们的语音识别应用 (Setting up our speech recognition app)

Let’s get started by setting up the HTML and CSS for the app. Below is the HTML markup:

让我们开始为应用程序设置HTML和CSS。 以下是HTML标记:

<!DOCTYPE html>
<html lang="en">
<head>
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值