Skip to content

Commit

Permalink
Create translatelearningcontent
Browse files Browse the repository at this point in the history
  • Loading branch information
srividyaprasad authored Feb 5, 2023
1 parent ce09da8 commit 174f44e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions features/translatelearningcontent
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from translate import Translator
thisdict = {
"Hindi": "hi",
"Kannada": "kn",
"Tamil": "ta",
"Telugu": "te",
"Urdu": "ur",
"Malayalam":"ml",
"Punjabi":"pa"
}
content=input('Enter content: ')
lang=input("Enter language: ")
translator= Translator(to_lang=thisdict[lang])
translation = translator.translate(content)
print(translation)

from gtts import gTTS #Import Google Text to Speech
from IPython.display import Audio #Import Audio method from IPython's Display Class
tts = gTTS(translation) #Provide the string to convert to speech
tts.save('1.wav') #save the string converted to speech as a .wav file
sound_file = '1.wav'
Audio(sound_file, autoplay=True)

n=int(input('Enter number of times to repeat every sentence: '))
from gtts import gTTS #Import Google Text to Speech
from IPython.display import Audio #Import Audio method from IPython's Display Class
tts = gTTS(content) #Provide the string to convert to speech
tts.save('2.wav') #save the string converted to speech as a .wav file
sound_file1 = '2.wav'
Audio(sound_file1, autoplay=True)

0 comments on commit 174f44e

Please sign in to comment.