-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.py
52 lines (45 loc) · 1.27 KB
/
functions.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
import tkinter as tk
from wordcloud import WordCloud
from matplotlib import pyplot as plt
from gtts import gTTS
from playsound import playsound
import time as t
# words & clouds
def figureCloud():
plt.figure(figsize=(10, 10))
plt.imshow(cloud, interpolation="bilinear")
plt.axis("off")
plt.savefig("imgs/cloud.jpg")
plt.show()
words = {
'Tokusatsu': 15,
'Video Games': 14,
'Fanfics': 13,
'Anime & Manga': 12,
'Money': 12,
'Friends': 12,
'Foods': 11,
'Pixelarts': 10
}
cloud = WordCloud(
font_path="fonts/HancomMalangMalang-Bold.ttf",
width=1000,
height=1000,
colormap='rainbow'
).generate_from_frequencies(words)
# langs & speech
def inputSpeaker():
lang = input("Select Your Language - English or Korean : ")
while "English" not in lang and "Korean" not in lang:
lang = input("PLZ Input Again - English or Korean : ")
if "English" in lang:
text = input("Input Eng Lines : ")
tts = gTTS(text=text, lang='en')
elif "Korean" in lang:
text = input("한국어로 문장을 입력하세요 : ")
tts = gTTS(text=text, lang='ko')
else:
tts = gTTS(text="Good Bye", lang='en')
tts.save("auds/speech.mp3")
t.sleep(5)
playsound("auds/speech.mp3")