A man who attacked and bit police officers has been sentenced to more than four years in prison