drachtio/drachtio-freeswitch-modules

is_final flag never true when languages other than en-US is used

codepie3 opened this issue · 3 comments

I am following the example in the repository for using google transcribe, this is the line of code which I am using to call the API, when the language code is en-US, it works absolutely fine but when I change it to for example en-GB as in example below I am not able to get the is_final flag as true,

ep.api('uuid_google_transcribe', [ep.uuid, 'start', 'en-GB','interim']

Here are some logs from the application in case it is needed,

1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" where"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"Hello"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" where's"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" where did"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" where did not"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" where did man"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" where did not give"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" not giving"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" not give in"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" not giving me"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" not giving me to"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did not"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" giving me to"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did not"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" giving me trouble"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did not giving me"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" trouble"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did not giving me trouble"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did not giving me"}]} 1|app | received transcription: {"stability":0.01,"is_final":false,"alternatives":[{"confidence":0,"transcript":" to Greenland"}]} 1|app | received transcription: {"stability":0.9,"is_final":false,"alternatives":[{"confidence":0,"transcript":"hello where did not giving me to Greenland"}]}

I tried using other languages such as en-IN but the problem is still exists, is_final flag never comes to be true but It works fine for en-US. Please let me know if any other information is required.

Thanks

please get logs from freeswitch with log level debug, that will show the raw transcriptions coming back from google, you will be able to see whether they are sending a final transcription

I checked logs from freeswitch, I am not getting is_final flag true for languages other than en-US, but this is not the case the case when I use python code here https://cloud.google.com/speech-to-text/docs/streaming-recognize with the same google credentials json.

I understand it sounds quite dumb as the code is just passing the parameters to google and getting transcript from there so it should work for all the languages but it is not the case, by chance anyone else has came across this issue or is it just me.

Thanks

I am facing the same issue earlier this year, but as of today I have used these modules with FreeSwitch 1.10.5 and I didn't face this issue as using en-IN for transcription.