Permalink
Browse files

Merge branch 'master' of git://github.com/nltk/nltk into positive-nai…

…vebayes
  • Loading branch information...
2 parents d35145b + 19dec81 commit 5ef26365deaa493dcd132bb1f6178e6bbddb01df @apresta apresta committed Feb 19, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 nltk/classify/naivebayes.py
@@ -34,7 +34,7 @@
from collections import defaultdict
-from nltk.probability import FreqDist, DictionaryProbDist, ELEProbDist, sum_logs
+from nltk.probability import FreqDist, ConditionalFreqDist, DictionaryProbDist, ELEProbDist, sum_logs
from api import ClassifierI
@@ -94,7 +94,7 @@ def prob_classify(self, featureset):
# Otherwise, we'll just assign a probability of 0 to
# everything.
featureset = featureset.copy()
- for fname in featureset:
+ for fname in featureset.keys():
for label in self._labels:
if (label, fname) in self._feature_probdist:
break
@@ -184,7 +184,7 @@ def train(labeled_featuresets, estimator=ELEProbDist):
i.e., a list of tuples ``(featureset, label)``.
"""
label_freqdist = FreqDist()
- feature_freqdist = defaultdict(FreqDist)
+ feature_freqdist = ConditionalFreqDist()
feature_values = defaultdict(set)
fnames = set()

0 comments on commit 5ef2636

Please sign in to comment.