You can train a cat not to slap, but a behaviorist can assist with this. There are good behaviors you can substitute for this bad behavior by using treats or rewards.  You must also train yourself to not overreact negatively to the slapping as that only increases it.