A naive way of doing that would be using a basic threshold to decide if a key was pressed or not. Reading data from your plot you can think about a thresold of say 4ms^-2 for the absolute value of the acceleration.
As you tagged with with machine learning I guess the naive way wasn't what you are looking for so another idea is a neural network.
The issue with this approach is that you need data to train the NN with. I would make a data collection app tracking the three axis(using alll of them will make the network a bit more less naive I suppose) and the keyboard input(key pressed or not) and then train the network with all this data and see what it comes out.
A naive way of doing that would be using a basic threshold to decide if a key was pressed or not. Reading data from your plot you can think about a thresold of say 4ms^-2 for the absolute value of the acceleration.
As you tagged with with machine learning I guess the naive way wasn't what you are looking for so another idea is a neural network. The issue with this approach is that you need data to train the NN with. I would make a data collection app tracking the three axis(using alll of them will make the network a bit more less naive I suppose) and the keyboard input(key pressed or not) and then train the network with all this data and see what it comes out.