snowboy: Provides its own types (#39545)

This commit is contained in:
Alexander T
2019-10-28 20:19:30 -07:00
committed by Jesse Trinity
parent 547555b921
commit 4f05aeed7e
5 changed files with 6 additions and 84 deletions
+6
View File
@@ -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",
-20
View File
@@ -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;
}
-40
View File
@@ -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');
-23
View File
@@ -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
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }