Cats tend to be very bipolar. They will be loving one minute and then moody the next. I would suggest getting her fixed because she might calm down a bit.
If your cat is sweet one minute and biting you the next, he may be telling you that you've crossed the line somewhere: Maybe he's tired of being petted, or maybe you found a sensitive spot.