-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab4.py
More file actions
61 lines (49 loc) · 1.32 KB
/
lab4.py
File metadata and controls
61 lines (49 loc) · 1.32 KB
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
import speech_recognition
import pyttsx3
# removing punctuation
punctuation = '!""()-_{}[];:/?\<>.@#$%^&*~`'
answer = ""
sampleString = "Hey Guys! This is Dylan. Do you have a cup of Coffee?"
for i in sampleString:
if i not in punctuation:
answer += i
print(f"this was the input string: {sampleString}")
print(f"This is the input without punctuations: {answer}")
print()
#
# # program to sort letters of word in a string
# questionString1 = "the big brown fox jumps over a lazy dog"
# splitted = questionString1.split()
#
# tupleQuesString1 = tuple(splitted)
# sorted = sorted(tupleQuesString1)
#
# sortedString = ""
# for word in sorted:
# sortedString += word + " "
#
#
# print(f"this is the question String: {questionString1}")
# print(f"this is the sorted string: {sortedString}")
#
#
# # for speech recognition
#
# recognizer = speech_recognition.Recognizer()
#
# while True:
# try:
# with speech_recognition.Microphone() as mic:
# recognizer.adjust_for_ambient_noise(mic, duration=0.2)
# audio = recognizer.listen(mic)
#
# text = recognizer.recognize_bing(audio)
# text = text.lower()
#
# print(f"Recognized {text}")
#
# except speech_recognition.UnknownValueError():
#
# recognizer = speech_recognition.Recognizer()
# continue
#