mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Feature: add digitCount to amd-utils (#1111)
* add digitCount to amd-utils * linting * bump verb-specs
This commit is contained in:
@@ -45,6 +45,7 @@ if (VMD_HINTS_FILE) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
class Amd extends Emitter {
|
||||
constructor(logger, cs, opts) {
|
||||
super();
|
||||
@@ -68,6 +69,8 @@ class Amd extends Emitter {
|
||||
this.getIbmAccessToken = getIbmAccessToken;
|
||||
const {setChannelVarsForStt} = require('./transcription-utils')(logger);
|
||||
this.setChannelVarsForStt = setChannelVarsForStt;
|
||||
this.digitCount = opts.digitCount || 0;
|
||||
this.numberRegEx = RegExp(`[0-9]{${this.digitCount}}`);
|
||||
|
||||
const {
|
||||
noSpeechTimeoutMs = 5000,
|
||||
@@ -163,6 +166,14 @@ class Amd extends Emitter {
|
||||
language: t.language_code
|
||||
});
|
||||
}
|
||||
else if (this.digitCount != 0 && this.numberRegEx.test(t.alternatives[0].transcript)) {
|
||||
/* a string of numbers is typically a machine */
|
||||
this.emit(this.decision = AmdEvents.MachineDetected, {
|
||||
reason: 'digit count',
|
||||
greeting: t.alternatives[0].transcript,
|
||||
language: t.language_code
|
||||
});
|
||||
}
|
||||
else if (final && wordCount < this.thresholdWordCount) {
|
||||
/* a short greeting is typically a human */
|
||||
this.emit(this.decision = AmdEvents.HumanDetected, {
|
||||
|
||||
Reference in New Issue
Block a user