Implement naivebayes.py but now it doesn't work in python3.