Classifying documents into categories