Hi!!!

I am making a program that is supose to use Naive bayes classifier to classify text from few categories. This is the best i can do to explain, here is what i have done so far:

import math

d=open('D.txt', 'r')

di=open('kat1.txt', 'r')

posleden = di.readlines()

total = d.readlines()

Di = posleden[len(posleden) -1]

D = total[len(total) -1]

P = float(Di)/float(D)

fajl = open('prob.txt', 'w')

fajl.write('P1=' + str(float(P)))

fajl.close()

for rec in di:

split_rec = rec.split('\t')

if len(split_rec) > 1:

print "word=%s, freq=%s" % \

(split_rec[0], split_rec[1])

Prob=float(split_rec[1] + 1)/(float(Di) + float(D))

fajl = open('prob.txt', 'w')

fajl.write('Prob1 =' + str(float(Prob)))

:(