forked from TechVine/Text-to-Speech-Converter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sotry_telling.py
145 lines (106 loc) · 9.26 KB
/
Sotry_telling.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import pyttsx3
assistantVoice = int(input('''Select you assistants Voice
[1] Male
[2] Female : '''))
if assistantVoice == 1:
engine = pyttsx3.init("sapi5")
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[0].id)
elif assistantVoice == 2:
engine = pyttsx3.init("sapi5")
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)
else:
print("Invalid Input")
'''-----------------------------------------------------------------------------------------------------------'''
file = open("story1.txt","w+")#The Cursed Man or King?
s1 = """In the Kingdom of Vijayanagara, there lived a man named Ramaya. The rumour was that if one saw Ramaya in the morning, they would be cursed and not be able to eat the whole day. Hearing this, the King wanted to test it out for himself.
The guards made the arrangements for Ramaya and set up a room right next to the King for him. The next morning, the King walked to Ramaya’s room, so he could look at him first thing and test this rumour out.
It just so happened that at lunchtime, the King spotted a fly in his meal and asked the cook to take it away and prepare a new lunch. By the time lunch was served again, the King had lost his appetite and realised that this rumour was indeed true – seeing Ramaya’s face first thing in the morning did cause people to be cursed. He didn’t wish this for his people and demanded that Ramaya be hanged.
Distraught, Ramaya’s wife goes to Tenali Raman for help as she doesn’t want to lose her husband. Hearing the whole story, Tenali Raman goes to Ramaya and whispers something into his ear, right before he is to be taken to be hanged.
On the same day, the guards ask Ramaya if he has any last wishes. Ramaya says he wants to give the King a note that he must read before the hanging. The guards deliver this note to the King. In the note were the words Tenali Raman had whispered – ‘If seeing Ramaya’s face, one loses their appetite; then a person who sees the King’s face, first thing in the morning, is destined to lose his life. Who is, therefore, more cursed – Ramaya or the King?’"""
file.write(s1)
'''-----------------------------------------------------------------------------------------------------------'''
'''-----------------------------------------------------------------------------------------------------------'''
file1 = open("story2.txt","w+")#Lion & rat
s2="""A Lion lay asleep in the forest, his great head resting on his paws. A timid little Mouse came upon him unexpectedly, and in her fright and haste to get away, ran across the Lion's nose. Roused from his nap, the Lion laid his huge paw angrily on the tiny creature to kill her.
"Spare me!" begged the poor Mouse. "Please let me go and some day I will surely repay you."
The Lion was much amused to think that a Mouse could ever help him. But he was generous and finally let the Mouse go.
Some days later, while stalking his prey in the forest, the Lion was caught in the toils of a hunter's net. Unable to free himself, he filled the forest with his angry roaring. The Mouse knew the voice and quickly found the Lion struggling in the net. Running to one of the great ropes that bound him, she gnawed it until it parted, and soon the Lion was free.
"You laughed when I said I would repay you," said the Mouse. "Now you see that even a Mouse can help a Lion."""
file1.write(s2)
'''-----------------------------------------------------------------------------------------------------------'''
'''-----------------------------------------------------------------------------------------------------------'''
file2 = open("story3.txt","w+")#two goats
s3="""There was a river in a small village. People use a narrow bridge built over the river to cross it. One day a goat was crossing the bridge. He saw another goat crossing the bridge in the opposite direction. The bridge was so narrow that there was no space for both of them to pass.
Both of the goats didn’t want to go back. One goat said to the other goat “You should go back since I am stronger than you”. The other goat denied saying it’s stronger. Both of them argued for a while. Later, one goat put down his horns to fight to show it is stronger than the other.
They fight furiously and both of them lost their balance and fell into the stream below. The swift current of the stream carried them away in deep water and both of them were drowned."""
file2.write(s3)
'''-----------------------------------------------------------------------------------------------------------'''
'''-----------------------------------------------------------------------------------------------------------'''
file3 = open("story4.txt","w+")#Handful of Grain and Coins
s4="""There was an arrogant woman named Vidhyulatha in the Vijayanagara Kingdom. She was proud of her accomplishments and loved showing off her intelligence. One day she put up a board outside her house, offering anyone 1000 gold coins if they could outsmart her wit, wisdom and intelligence.
Many scholars took up her challenge, but she could not be defeated. That is until one day a man selling firewood arrived. He started shouting on top of his voice outside her door. Irritated with his shouting, Vidhyulatha asked the man to sell her his firewood.
The man said he would sell her his firewood in exchange for a ‘handful grain.’ She agreed and asked him to put the firewood in the backyard. However, the man insisted that she had not understood what he had actually asked for. He then said that if she couldn’t pay him the exact price of a ‘handful grain’, then she must take down her challenge board and give him 1000 gold coins.
Getting angry, Vidhyulatha accused him of talking nonsense. The vendor said it was not nonsense, and since she had not understood his price, she should concede defeat. Hearing these words, Vidhyulatha started getting frustrated with the vendor. After hours of arguing, they decided to go to the provincial court.
The judge heard what Vidhyulatha had to say and then asked the firewood vendor to give his explanation. The vendor explained that he wanted a ‘handful grain’ which means a singular grain that would fill a hand. Since she failed to understand this, Vidhyulatha was bested and therefore she needed to take down her board and give the vendor the 1000 gold coins.
Impressed, the judge agreed, and the matter was resolved. After Vidhyulatha took down her board, she asked the vendor who he really was, doubting a simple firewood vendor could have bested her. Taking off his disguise, Tenali Raman revealed himself! He wanted to teach the arrogant and snobbish Vidhyulatha a lesson in being humble. Lesson learned!"""
file3.write(s4)
'''-----------------------------------------------------------------------------------------------------------'''
'''-----------------------------------------------------------------------------------------------------------'''
file4 = open("story5.txt","w+")#Saluting the Donkeys
s5= """In the King’s court, there was a very orthodox teacher named Tathacharya who belonged to the Vaishnavite sect. He looked down on other people, especially the Smarthas – covering his face with a cloth whenever he saw people from this and other sects.
Fed up of this behaviour, the King and other courtiers went to Tenali Raman for his help. After listening to everyone’s complaints about the royal teacher, Tenali Raman went to Tathacharya’s house. Upon seeing Tenali, the teacher covered his face. Seeing this, Tenali asked him why he did that. He explained that Smarthas were sinners and to look upon the face of a sinner meant that he would be turned into a donkey in his next life. That’s when an idea struck Tenali!
One day, Tenali, the King, Tathacharya and the other courtiers went on a picnic together. As they were returning from their picnic, Tenali spotted some donkeys. He immediately ran up to them and started saluting them. Puzzled, the King asked Tenali why he was saluting the donkeys. Tenali then explained that he was paying his respects to Tathacharya’s ancestors, who had become donkeys after looking at the faces of Smarthas.
Tathacharya understood Tenali’s harmless behaviour, and from that day forward, never covered his face again.
"""
file4.write(s4)
'''-----------------------------------------------------------------------------------------------------------'''
choice="""Which story you want to hear
1)The Cursed Man or King?
2)Lion & Rat
3)Two Goats
4)Handful of Grain and Coins
5)Saluting the Donkeys
"""
file.close()
file1.close()
file2.close()
file3.close()
file4.close()
r1= open("story1.txt","r")
r2= open("story2.txt","r")
r3= open("story3.txt","r")
r4= open("story4.txt","r")
r5= open("story5.txt","r")
engine.say(choice)
engine.runAndWait()
inp = int(input("1/2/3/4/5 :- "))
if(inp == 1):
for x in r1:
print(x)
engine.say(x)
engine.runAndWait()
r1.close()
elif(inp == 2):
for x in r2:
engine.say(x)
engine.runAndWait()
r2.close()
elif(inp == 3):
for x in r3:
engine.say(x)
engine.runAndWait()
r3.close()
elif(inp == 4):
for x in r4:
engine.say(x)
engine.runAndWait()
r4.close()
elif(inp == 5):
for x in r5:
engine.say(x)
engine.runAndWait()
r5.close()
else:
print("Invalid Input")