ianhajra / virtual_assistant

This repository houses the code for running a local virtual assistant. It is still under development.
MIT License
5 stars 0 forks source link

Write tests for stt.py #19

Closed ianhajra closed 2 months ago

ianhajra commented 2 months ago

It is essential that the speech to text functionality of this program is consistent and effective. To ensure this is the case, we will need to have a robust set of tests that validate the consistency of this.

Tests should be placed in a new file that will be created when working on this issue: tests/nlp_tests/test_stt.py

We need these tests to use pytest for a consistent testing experience of the entire software.

chungjryan commented 2 months ago

@ianhajra have we decided what libraries to use for stt?

ianhajra commented 2 months ago

@chungjryan I'll create an issue where we can dump ideas of good stt libraries into the comments. There are significant drawbacks to all of them, so we'll need to evaluate what works best

For now, go ahead and create a def stt(filepath: str) -> str: within speech_to_text.py and add the following line to init.py in nlp: from .speech_to_text.py import stt

That way, you can create the test_stt.py file and call from nlp import stt, then create a set of assertions that call something like the following:

assert stt('audio/path_one.wav') == "Hello world" assert stt('audio/path_two.wav') == "This is a test of a longer sentence" etc.

I know we haven't created the audio files and paths yet, there will be a separate issue that will create audio paths for each of the test cases you write. You can assume the pathing used in the above examples will work.