Python Forum
[split] Offline audio to text (Speech Recognition) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: [split] Offline audio to text (Speech Recognition) (/thread-12594.html)



[split] Offline audio to text (Speech Recognition) - Nishant260190 - Sep-02-2018

Hi I am using the same library and its working fine.
But I need timing of words also.
Is there any way in this library or any other library to get the timings.

I am trying to convert a speech in Hindi language to text.
I have tried to use amazon speech to text but results are pathetic.
I tried to google speech(with long recognise) to text it is giving words with timing but converting 10 lines of sentence in to 2 line only means I am not getting most of the words.
Code :

import time
from google.cloud import speech
client = speech.SpeechClient()
operation = client.long_running_recognize(audio=speech.types.RecognitionAudio(uri='gs://bucketname/samplefile.wav'), config=speech.types.RecognitionConfig(encoding='LINEAR16', language_code='en-US'))
retry_count = 100
print(operation)
for result in operation.results:
	for alternative in result.alternatives:
		print('=' * 20)
		print(alternative.transcript)
		print(alternative.confidence)
Is there any way to get it.