stab at regeneralizing script for Naive Bayes