• w2_549856
    了解作者
  • 8.5KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-15 07:20
    上传日期
GSpeech API 周围的node.js包装器库,用于自动语音识别。 易于使用的高质量语音识别 对Google自动语音识别服务器的无限请求 访问定时成绩单 基本用法 对于60秒以下的剪辑,用法很简单: var gspeech = require ( 'gspeech-api' ) ; gspeech . recognize ( 'path/to/my/file' , function ( err , data ) { if ( err ) console . error ( err ) ; console . log ( "Final transcript is:\n" + data . transcript ) ; } ) ; Google服务器会忽略60秒钟以上的片段,因此,对于超过此长度的片段,您必须指定如何将音频文件拆分为多个片段。 要
speech-to-text-master.zip
  • speech-to-text-master
  • gspeech-api
  • index.js
    6.9KB
  • package.json
    679B
  • data
  • .gitignore
    68B
  • test_package.js
    586B
  • request_test.js
    379B
  • speech_api.js
    4KB
  • README.md
    4.4KB
内容介绍
# GSpeech API A node.js wrapper library around the [Google Speech API](https://www.google.com/intl/en/chrome/demos/speech.html) for automatic speech recognition. ## Easy-to-use high-quality speech recognition * Unlimited requests to Google automatic speech recognition servers * Access to timed transcripts ## Basic Usage For clips under 60 seconds, usage is simple: ```javascript var gspeech = require('gspeech-api'); gspeech.recognize('path/to/my/file', function(err, data) { if (err) console.error(err); console.log("Final transcript is:\n" + data.transcript); }); ``` Google servers ignore clips over 60 seconds, so for clips longer than that, you have to specify how you want your audio files split into pieces. To use default package settings, the same code from above for clips under 60 seconds works. The speed varies, but in general, one hour of audio will take a couple minutes to process. ## Installation Gpseech-api relies on [fluent-ffmpeg](https://www.npmjs.com/package/fluent-ffmpeg) to deal with different audio formats, which has a dependency on ffmpeg. You can install ffmpeg [HERE]. `npm install gspeech-api` ### Dependencies * request * fs * temp * async * fluent-ffmpeg Fluent-ffmpeg has an additional requirement that ffmpeg is already installed on your system. You can install it [HERE] ## Documentation This package exposes one main method, `gspeech.recognize(options, callback)` for taking a file and returning an array of timed captions along with a final transcript. ### Arguments ##### Options If `options` is passed as a `String`, it is taken as the path for `file`. Otherwise, it should be an Object, which can have the following attributes: * `file` - path to the audio file to be transcribed. * `segments` (optional) - `[start]` Specifies how to divide the audio file into segments before transcription. `start` is a `float` specifying a track time in seconds. If this argument is not specified, the audio is split into 60 second segments (the maximum length allowed by Google's servers). If a segment is longer than 60 seconds, it is split into 60 second segments. * `maxDuration` (optional) - any segments longer than `maxDuration` will be split into segments of `maxDuration` seconds. Defaults to 15 seconds. * `maxRetries` (optional) - sometimes Google servers do not respond correctly, if a segment is not processed correctly, it will be sent again `maxRetries` more times. Defaults to 1. * `limitConcurrent` (optional) - Google's servers communicate through separate GET and POST requests - sending too many requests at once may cause the two requests to not line up, resulting in errors. This defaults to 20. #### Callback Callback is a function which will be called after all requests to Google speech servers have completed. It is passed two parameters `callback(err, data)`: * `err` - contains an error message, if error occurs * `data` - contains an Object with the following fields, if all requests are successful: * `transcript` - `String`: text of complete transcript * `timedTranscript` - `[{'start': float, 'text': String}]`: unprocessed text of each segment transcribed separately by Google speech servers. If `options.segments` is specified, each object corresponds to a segment; otherwise, each object designates how the audio file was split before being transcribed. ### More Examples #### Getting a timed transcript ```javascript gspeech.recognize('path/to/my/file', function(err, data) { if (err) console.error(err); for (var i = 0; i < data.timedTranscript.length; i++) { // Print the transcript console.log(data.timedTranscript[i].start + ': ' + data.timedTranscript[i].text + '\n'); } }); ``` #### Specifying times to split audio If you would like to generate a timed transcript, and know where fragments start, specify these times to the library. ```javascript var segTimes = [0, 15, 20, 30]; gspeech.recognize({ 'file': 'path/to/my/file', 'segments': segTimes, }, function(err, data) { if (err) console.error(err); for (var i = 0; i < data.timedTranscript.length; i++) { console.log(data.timedTranscript[i].start + ': ' + data.timedTranscript[i].text + '\n'); } } ); ``` ## Disclaimer This is not an officially supported Google API, and should only be used for personal purposes. The API is subject to change, and should not be relied upon by any crucial services.
评论
    相关推荐
    • WebSocket仿真-Node.js服务器-Node.js开发
      SockJS系列:SockJS客户端JavaScript客户端库SockJS节点Node.js服务器SockJS erlang Erlang服务器SockJS-tornado Python / Tornado服务器vert.x Java / vert.x服务器正在进行中:SockJS-ruby SockJS-netty SockJS...
    • 沙发服务器:Couch测试服务器Node.js,Typescript
      沙发服务器:Couch测试服务器Node.js,Typescript
    • TwittnukerGCMServer_node:Twittnuker GCM 服务器 node.js 实现
      Twittnuker 自托管 GCM 推送服务器 node.js 中的 Twittnuker GCM 推送服务器实现。 安装 npm install 去做
    • Node.js 7.x异步/等待支持演示-Node.js开发
      Node.js v7.xx附带实验性的异步/等待支持,大大简化了编写现代服务器端代码所需的样板。 该项目是Node.js v7 async / await演示的演示。这是什么? Node.js v7.xx附带实验性的异步/等待支持,大大简化了编写现代...
    • 服务器JavaScriptNode.js
      服务器JavaScript之利器Node.js
    • node.js:学习 node.js
      基于一本叫node.js的教材,学习node.js服务器开发 要求 节点.js 15.2.1 npm 7.0.10 快速开始 第一个休息服务器 cd Document/ch4 node restServer.js 在控制台勾选“Server is waiting on port 8082”后,用...
    • TeonetJS:Teonet服务器Node.js模块
      在和使用的Teonet服务器node.js模块,用于将node.js服务器应用程序与Teonet连接。 安装 npm install teonet 开发人员注意事项 在构建此软件包之前使用: sudo apt-get install build-essential
    • hapi, 面向 node.js服务器框架.zip
      hapi, 面向 node.js服务器框架 Web和服务应用框架领导维护者: Eran Hammer 。是一个简单易用的配置框架,支持输入验证,缓存,认证以及其他用于构建网络和服务应用程序的重要设施。 让开发者专注于以高度模块化和...
    • monstre:首要服务器node.js
      怪物 第一台服务器node.js
    • MT4-Node.js, MT4 node.js 客户/服务器桥.zip
      MT4-Node.js, MT4 node.js 客户/服务器桥 MT4-Node.jsMT4 node.js 客户端/服务器访问企鹅 trader,从社区获得帮助这演示了如何在 node.js 服务器和MT4客户端应用程序之间快速通信。 没有延迟,连接/计算是在相同的...