-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speech recognition #19
base: main
Are you sure you want to change the base?
Conversation
Is this ready to review? |
813b0dd
to
c121a52
Compare
Yes! |
with ZipFile("../data/vosk-model-small-en-us-0.15.zip", 'r') as zObject: | ||
|
||
# Extracting the zip | ||
zObject.extractall(path="../data") | ||
|
||
# Delete the zip file | ||
os.remove("../data/vosk-model-small-en-us-0.15.zip") |
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.
I think it would be better to generalize this and move it inside the for
above it.
Check if the file extension is .zip
, in which case you extract it and delete the .zip
file.
def install_packages(): | ||
"""Install the required python libraries.""" | ||
|
||
for package in PACKAGES: | ||
print("Downloading python library {}...".format(package)) | ||
try: | ||
subprocess.check_call([sys.executable, "-m", "pip", "install", package], stdout=subprocess.DEVNULL) | ||
except Exception as e: | ||
print("Failed to download library {}".format(package)) | ||
print("Exception {}".format(e)) |
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.
Installing python packages is not so straight forward on my distro, I would prefer us adding a requirements.txt
with the necessary packages and just install them with pip
.
def emotionFromPhrase(self): | ||
# TODO: implement this |
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.
Shouldn't this be within nlp.py
?
def __init__(self, phrase) -> None: | ||
self.phrase = phrase | ||
|
||
def setPhrase(self, phrase): |
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.
Maybe rename to set
?
self.phrase = phrase | ||
|
||
def setPhrase(self, phrase): | ||
self.phrase = self |
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.
self.phrase = self | |
self.phrase = phrase |
def setPhrase(self, phrase): | ||
self.phrase = self | ||
|
||
def getPhrase(self): |
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.
Maybe rename to get
?
while True: | ||
try: | ||
data = self.stream.read(4096) | ||
if self.recognizer.AcceptWaveform(data): | ||
res = json.loads(self.recognizer.Result()) | ||
phrase = res["text"] | ||
print(phrase) | ||
except KeyboardInterrupt: | ||
break |
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.
Any ideas on how to integrate it with the rest of the code?
No description provided.