converting old naivebayes code to current assignment structure