Sports statistics

The film Moneyball probably contributed to the increasing popularity of using stastitics in sports. Stats are also increasingly logically used in sports betting, a multi-billion industry. The things is, unless you're a professional athlete, the only way today to have access to your own personal statistics relies on using fitness apps which data is often limited to heart rate and movement time. That type of data however isn't really useful to improve one's game. What if I want to get a sense of which specific situations lead me to make more mistakes which would then allow me to focus on specific aspects during training? What if I want to see if I perform better in the morning versus the afternoon when it comes to serving or my backhand?

That's where my little speech-to-text program, created in January 2016, comes in. I first defined a taxonomy of codes that correspond to each player (e.g. player 1 is "A") and to each game situation (see the screenshot below for various possible shots in a game of squash).

Then during the actual game, I record the audio of everything players are saying. The recording can be done using any smartwatch, smartphone or audio recording device like the Zoom h1n. To be able to automatically analyse the audio file, players have to use a keyword (in this case, it's "Google", a little bit like one would say "OK Google" to activate the Google Assistant) before enunciating the code that describes what just happened.

Google's speech-to-text API then allows me to analyse the audio and transcribe the file into readable text. This is a typical excerpt from such a text file (highlights added to emphasise the relevant bits that will be parsed):

"Alright let's get started. I'm serving first. Google B2 aaaahhh yes I won hahaha Google A10. Your turn Google A7. Oh no... no, no, no! Google B3 Google A1"

Some little JavaScript coding in Google's Apps Script then allows to parse that text and produce what you see in the image below.

And finally some additional spreadsheet coding allows to provide a summary of statistics for each player.