Voice Chess Speech Recognition Customization Guide
Voice Chess application allows for relatively easy and robust customisation of its speech recognition. The application loads all piece names as well as board coordinates descriptions from a YAML file. If you wish to change pieces’ names, for example to introduce support for new language you’ll need to prepare correct tokens file and a Vosk speech recognition model, that will be compatible with the tokens used in said file.
Tokens
The tokens file is a simple YAML file containing single dictionary, where each key is english name of a piece or action or board coordinate and values are lists of words you would like to use to mean this particular token.
Please make sure the words do not repeat between different tokens, as this will lead to incorrect behaviours.
The default installation of Voice Chess comes with 2 token files: en-default.yaml and pl-default.yaml, which are for english and Polish languages respectively. You can use them as a template.
Vosk Models
If you have the token file then it is time to prepare the Vosk model so it would be compatible with your tokens.
By default, any Vosk model from this list will work for the tokens of the same language as the language of the model. However, the quality of recognition may be less than desirable, which is why you may want to perform model customisation.
Please note, that the default english and Polish Vosk models have been customised for the provided token files and will no longer work with other token files!
For model customisation you will need a sample text file with all possible move commands. To generate this file you can use the PGN file with all chess games of Najdorf and helper script, both of which are provided in Voice Chess Customisation package available for download at Voice Chess store page.
The usage of the script is simple (assuming you have python installed and available in path):
python pgn-extract.py --language=tokens.yaml najdorf.pgn najdorf-tokens.txt
where you should change the tokens.yaml to the path to the tokens file you have created.
Once you have obtained the najdorf-tokens.txt file proceed with this instructions to customise the Vosk speech recognition model to your new tokens.
The last thing to do is to place your newly trained model in the models/your-model-name directory inside the Voice Chess directory and your tokens.yaml file in the Voice Chess directory. Then you can use this new model along with the new tokens file with command line options, which are discussed here.