I would apply the same test for hitting a woman who was attacking me as I would for a man: Is this individual presenting a significant danger to me that I can't safely handle with a lower level of force?
Now, statistically speaking, there are fewer women than men who would present such a danger. Women, on average, are smaller, physically weaker, and less likely to have significant fighting experience than men. I'm a 6'4", 200 lb man with 41 years of martial arts training and a black belt in BJJ. Against the majority of women out there, if they attacked me unarmed, I could safely defend myself by deflecting their attacks, restraining them, or just letting them hurt themselves on my blocks. (The same would go for a much smaller, weaker, and untrained man.)
But real world attacks come from individuals, not statistical averages. There are women out there who could hurt me badly if I didn't take them every bit as seriously as a male attacker. If I were ever attacked by such a woman I would treat them just the same as a man who posed a real threat to me - which might include hitting them.