mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
snowboy: Provides its own types (#39545)
This commit is contained in:
committed by
Jesse Trinity
parent
547555b921
commit
4f05aeed7e
@@ -3624,6 +3624,12 @@
|
||||
"sourceRepoURL": "https://github.com/not-an-aardvark/snoowrap",
|
||||
"asOfVersion": "1.19.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "snowboy",
|
||||
"typingsPackageName": "snowboy",
|
||||
"sourceRepoURL": "https://github.com/Kitt-AI/snowboy",
|
||||
"asOfVersion": "1.3.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "soap",
|
||||
"typingsPackageName": "soap",
|
||||
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
// Type definitions for snowboy 1.2
|
||||
// Project: https://github.com/Kitt-AI/snowboy
|
||||
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Stream } from "stream";
|
||||
|
||||
export type State = "sound" | "silence" | "hotword" | "error";
|
||||
|
||||
export class Detector extends Stream {
|
||||
constructor(params: any);
|
||||
|
||||
on(event: State | symbol, callback: (index: any, hotword?: any, buffer?: Buffer) => void): this;
|
||||
}
|
||||
|
||||
export class Models {
|
||||
add(params: any): void;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
import { Detector, Models } from "snowboy";
|
||||
import * as fs from "fs";
|
||||
|
||||
const models = new Models();
|
||||
|
||||
models.add({
|
||||
file: 'resources/snowboy.umdl',
|
||||
sensitivity: '0.5',
|
||||
hotwords: 'snowboy'
|
||||
});
|
||||
|
||||
const detector = new Detector({
|
||||
resource: "resources/common.res",
|
||||
models,
|
||||
audioGain: 1.0
|
||||
});
|
||||
|
||||
detector.on('silence', () => {
|
||||
console.log('silence');
|
||||
});
|
||||
|
||||
detector.on('sound', (buffer) => {
|
||||
// <buffer> contains the last chunk of the audio that triggers the "sound"
|
||||
// event. It could be written to a wav stream.
|
||||
console.log('sound');
|
||||
});
|
||||
|
||||
detector.on('error', () => {
|
||||
console.log('error');
|
||||
});
|
||||
|
||||
detector.on('hotword', (index, hotword, buffer) => {
|
||||
// <buffer> contains the last chunk of the audio that triggers the "hotword"
|
||||
// event. It could be written to a wav stream. You will have to use it
|
||||
// together with the <buffer> in the "sound" event if you want to get audio
|
||||
// data after the hotword.
|
||||
console.log('hotword', index, hotword);
|
||||
});
|
||||
|
||||
const file = fs.createReadStream('resources/snowboy.wav');
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"snowboy-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user