Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cmusphinx/node-pocketsphinx
Pocketsphinx bindings for Node.JS
https://github.com/cmusphinx/node-pocketsphinx
Last synced: 28 days ago
JSON representation
Pocketsphinx bindings for Node.JS
- Host: GitHub
- URL: https://github.com/cmusphinx/node-pocketsphinx
- Owner: cmusphinx
- License: other
- Fork: true (moneppo/node-pocketsphinx)
- Created: 2014-06-04T15:32:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-03-12T07:04:18.000Z (almost 6 years ago)
- Last Synced: 2024-11-10T22:03:56.540Z (about 1 month ago)
- Language: CMake
- Homepage:
- Size: 71.3 KB
- Stars: 243
- Watchers: 11
- Forks: 47
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- low-resource-languages - node-pocketsphinx
README
# PocketSphinx for Node.js
This module aims to allow basic speech recognition on portable devices
through the use of PocketSphinx.## Installation
Windows installation is not supported yet.
To build this module you need to have following dependencies:
* node at least 4.2
* cmake at least version 3.1
* cmake-js https://github.com/cmake-js/cmake-js (install with `npm install -g cmake-js`)
* sphinxbase latest from github
* pocketsphinx latest from github
* swig at least 3.0.7
* pkg-configMake sure that pocketsphinx is installed properly, adjust LD_LIBRARY_PATH if libraries are not found. You can test pocketsphinx with
pocketsphinx_continuous -infile goforward.raw // Recognize goforward.raw file
Make sure that PKG_CONFIG_PATH includes the folder where you installed pocketsphinx, for example, if you installed with default prefix, export PKG_CONFIG_PATH:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
You can test installation with
pkg-config --modversion pocketsphinx // This should print the version
To build simply use npm install, it should detect everything automatically. Carefully read
build logs in order to see if there are any issues.## Example
```javascript
var fs = require('fs');var ps = require('pocketsphinx').ps;
modeldir = "../../pocketsphinx/model/en-us/"
var config = new ps.Decoder.defaultConfig();
config.setString("-hmm", modeldir + "en-us");
config.setString("-dict", modeldir + "cmudict-en-us.dict");
config.setString("-lm", modeldir + "en-us.lm.bin");
var decoder = new ps.Decoder(config);fs.readFile("../../pocketsphinx/test/data/goforward.raw", function(err, data) {
if (err) throw err;
decoder.startUtt();
decoder.processRaw(data, false, false);
decoder.endUtt();
console.log(decoder.hyp())
});
```