Runs a local server hosting four microservices for: Text to Speech, Speech to Text, Text Question to Text Answer, Spoken Question to Spoken Answer.
- See Requirements!
- Open
twoterminals and follow step2for both of them - Navigate to the
alexa-microservicedirectory containingalexa-microservice.go(and therun-serverscripts) - In the
first terminaluse command:bash run-server.shfor Linux, or.\run-server.ps1for Windows Powershell - In the
second terminalKEEPalexa-microserviceas the root directory, and from here run thetestscripts- Example:
bash test/<name-test>.sh
- Example:
Issues
- If step
3failed, ensure the correct permissions for all files within thealexa-microservicedirectory are granted base64can vary acrossLinuxversions, which can cause incompatable whitespace being encoded . . .- For Ubuntu:
base64 -ishould work fine - If this command fails, use:
base64 -w 0 -i - Finally if both fail, the input is most likely incorrect
- For Ubuntu:
gorilla muxmust be install, use command:go get -u github.com/gorilla/mux- Two keys must be provided for
WolframAlphaandMicrosoft Cognitive Servicesinside theconfig.jsonfile- If you do not have keys for these services they can be obtained via their respective sites
All four microservices expect a specific JSON object as input.
alpha.goandtts.gorequire a JsonText object which contains a text query- Example:
{"text": "What is the melting point of silver?"}
- Example:
stt.goandalexa.gorequire a JsonSpeech object which contains a spoken query as a base64 encoded.wav(WAVE) file- Example:
{"speech": "<.wav>(base64)"}
- Example:
| Directories | |
|---|---|
bin/ |
Hosts the exeutable and any files it needs |
config/ |
Contains config.go a handler for config.json which stores vital information for all the microservices to run |
res/ |
Holds various resource files for the user to utilise or to be used as a file output dump during the programs debug method |
services/ |
Package directory storing the microservices used in the program |
test/ |
Stores all the test scripts with both bash and powershell variants |
| Root Files | |
|---|---|
alexa-microservice.go |
The main program, runs several go routines to create multiple listerner threads for the microservices |
go.mod |
Hosts the alexa-microservice module requirements |
run-server.sh |
Script to build and run the alexa-microservice server (for Bash) |
run-server.ps1 |
Windows Powershell variant of run-server.sh |
| Services | |
|---|---|
alpha.go |
Microservice which provides computational knowledge via communication with WolframAlpha's API |
stt.go |
Microservice which computes Speech to Text using Microsoft Cognitive Services (MCS) |
tts.go |
Microservice which computes Text to Speech using Microsoft Cognitive Services (MCS) |
alexa.go |
Microservice which commits several queries to convert a spoken question to a spoken answer |
utils.go |
Hosts utility functions, variables, & structs used in data representation |
Debug: Write Resource to File
In services/utils.go if debugWriteResourceToFile is set to true,
files managed by each microservice will be written to the resource directory (/res)