-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed the notes function, removed the emojies
- Loading branch information
1 parent
f7b5bc6
commit c4b4a2f
Showing
9 changed files
with
83 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from cli.utils import user, bot, write_note | ||
|
||
def write(a): | ||
file = open("user_" + a + "txt", "w") | ||
note = write_note.write_note() | ||
file.write(note) | ||
print("A new note is created!") | ||
|
||
def main(): | ||
bot.bot("Searching for Notes") | ||
try: | ||
if user.user == 0: | ||
file = open("general.txt", "r") | ||
bot.bot(file.read()) | ||
elif user.user == 1: | ||
file = open("user_1.txt", "r") | ||
elif user.user == 2: | ||
file = open("user_2.txt", "r") | ||
elif user.user == 3: | ||
file = open("user_3.txt", "r") | ||
|
||
except FileNotFoundError: | ||
bot.bot("No notes are available.") | ||
bot.bot("Want to created one now?") | ||
q = sr.Recognizer() | ||
t = 0 | ||
with sr.Microphone() as source: | ||
while t == 0: | ||
audio = q.listen(source, phrase_time_limit=5) | ||
try: | ||
res = q.recognize_google(audio) | ||
t = 1 | ||
if "yes" in res: | ||
bot.bot("What should I write?") | ||
elif user.user == 0: | ||
cli.utils.notes.write("0") | ||
elif user.user == 1: | ||
cli.utils.notes.write("1") | ||
elif user.user == 2: | ||
cli.utils.notes.write("2") | ||
elif user.user == 3: | ||
cli.utils.notes.write("3") | ||
else: | ||
bot.bot("Okay, exiting the note section") | ||
except: | ||
print('Not understandable') | ||
print('Try again') | ||
t = 0 | ||
bot.bot("A new note is created!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import speech_recognition as sr | ||
|
||
def write_note(): | ||
mic = sr.Microphone() | ||
r = sr.Recognizer() | ||
with mic as source: | ||
print("What to write in the note!") | ||
note = r.listen(source) | ||
try: | ||
note = r.recognize_google(note).lower() | ||
print("The note will be written as: " + note) | ||
except sr.UnknownValueError: | ||
print("Sorry I didn't get you. Kindly say again.") | ||
note = write_note() | ||
|
||
return note |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c4b4a2f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the emojis were spelled out, like magnifying glass and so on...