refactoring the example: language classifier
bayes classifier