mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
amd spoken digit recognition
This commit is contained in:
@@ -152,6 +152,18 @@ class Amd extends Emitter {
|
||||
if (Array.isArray(t.alternatives) && t.alternatives.length > 0) {
|
||||
const wordCount = t.alternatives[0].transcript.split(' ').length;
|
||||
const final = t.is_final;
|
||||
const transcript = t.alternatives[0].transcript;
|
||||
|
||||
const digitRegex = /\b(\d{3,})\b/; // 3 or more digits
|
||||
const foundDigits = digitRegex.test(transcript);
|
||||
|
||||
if (foundDigits) {
|
||||
// Emit machine detected if spoken digits are found (applies to both partial and full transcripts)
|
||||
this.emit(this.decision = AmdEvents.MachineDetected, {
|
||||
reason: 'spoken digits',
|
||||
transcript,
|
||||
language: t.language_code
|
||||
});
|
||||
|
||||
const foundHint = hints.find((h) => t.alternatives[0].transcript.includes(h));
|
||||
if (foundHint) {
|
||||
|
||||
Reference in New Issue
Block a user