calpoly-csai / swanton

Swanton Pacific Ranch chatbot with a knowledge graph
MIT License
3 stars 1 forks source link

added audio_response.py #21

Closed chidiewenike closed 4 years ago

chidiewenike commented 4 years ago

Summary

Takes the file map dictionary, response string, and the path to the response audio directory to output the audio.

Test

Input an unknown response to generate the default "incorrect" output response. The audio output corresponds to the default response text.

$ python .\audio_response.py "Hey"

>> "Hey" maps to "speech_sample_25.wav"
>> Playing file => "\path\to\swanton\response_data\speech_sample_25.wav"

Then a known response was used to test the mapping of known responses. The audio output corresponds to the correct response text.

$ python .\audio_response.py "In April, 1897, Pasquale Sonognini, a driver of the Santa Cruz-Pescadero stage, applied for a post office to be known as Trancas near the junction of Scott and Big creeks and on the 
Santa Cruz and Pescadero Stage Road (now Swanton Road). When the Post Office Department approved the office for opening May 28, 1897, it bestowed upon it the name of Swanton. The post office was closed on December 31, 1930. "

>> "In April, 1897, Pasquale Sonognini, a driver of the Santa Cruz-Pescadero stage, applied for a post office to be known as Trancas near the junction 
of Scott and Big creeks and on the Santa Cruz and Pescadero Stage Road (now Swanton Road). When the Post Office Department approved the office for opening May 28, 1897, it bestowed upon it the name of Swanton. The post office was closed on December 31, 1930. " maps to "speech_sample_27.wav"     
>> Playing file => "\path\to\swanton\response_data\speech_sample_27.wav"