This repository has been archived on 2025-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
Files
enginex-mr_series-sherpa-onnx/scripts/node-addon-api/lib/spoken-language-identification.js

31 lines
768 B
JavaScript

const addon = require('./addon.js');
const non_streaming_asr = require('./non-streaming-asr.js');
class SpokenLanguageIdentification {
constructor(config) {
this.handle = addon.createSpokenLanguageIdentification(config);
this.config = config;
}
createStream() {
return new non_streaming_asr.OfflineStream(
addon.createSpokenLanguageIdentificationOfflineStream(this.handle));
}
// return a string containing the language code (2 characters),
// e.g., en, de, fr, es, zh
// en -> English
// de -> German
// fr -> French
// es -> Spanish
// zh -> Chinese
compute(stream) {
return addon.spokenLanguageIdentificationCompute(
this.handle, stream.handle);
}
}
module.exports = {
SpokenLanguageIdentification,
}