A man who bit off part of a police officer's ear has been jailed for more than three years.