Design of VoiceRecognitionService
- Use PEP8 standards.
- Classnames are normally camel-case. So, VoiceRecognitionService as opposed to underscore separated.
- Function names are normally underscore separated
- So, create a class, called something like VoiceRecognitionService, which derives from QObject (so we can emit signals and slots).
- You should do all connection and setup in the constructor.
- Fail with exceptions if anything at all is wrong. This way you don't ever let the user have an improperly constructed or initialised object.
- You must call the base class constructor, like in this, otherwise signals and slots just don't work.
- Create signals: next, previous, undo, with no arguments, like shown here. My aim here is that these are sufficiently generic and would be suitable for any application.
- Create a more generic command: voice_command(str), like shown here which will output any command string, just as a string. (i.e. regardless of the context, or who is listening).
- Use a logging class, to write a log statement every time you emit a signal. This way you can at least watch the code on console. Don't use print directly, as its not Py27 and Py36 compatible.
- Check for the functionality to add Strings which are then more likely understood by the google cloud api when there are multiple alternatives.
More later. Got to run.