There's no definitive answer to this question, as cats can be unpredictable creatures. However, many people believe that cats scratch humans deliberately in order to mark their territory or show dominance. So, in short, cats probably do know when they're scratching you, and they may even do it on purpose.