Classifying single stars and spectroscopic binaries using optical stellar templates