Two police officers have been commended for saving the life of a man who was attacked with a machete.