ariym/whisper-node

Recognize Language of Input File

hermify opened this issue · 2 comments

When the language is set to "auto", is there a way to get the analyzed language of the input file?

You can grep the information in the shell-function:

if(stderr?.includes("auto-detected language")) {
	// Grep the language  and correlation (auto-detected language: XXXX (p = 0.999))
	// languageAtts = stderr.match(/auto-detected language: (.*) \(p =/)
	languageAtts = stderr.match(/auto-detected language: (.*) \(p = (.*)\)/)
	language = 				languageAtts[1]
	languageCorrelation = 	languageAtts[2]
}

if (code === 0){
	resolve({
		transcript: stdout,
		language: language,
		languageCorrelation: languageCorrelation
	})
}else{
	reject(stderr)
} 
ariym commented

Added to Roadmap