Skip to content
Browse files

Reverting to plain defaultdict(FreqDist) as in NaiveBayesClassifier

  • Loading branch information...
1 parent 45c5980 commit b4ff33a36be8b56478a6e1472c3532a1d9dcd940 @apresta apresta committed Feb 19, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 nltk/classify/positivenaivebayes.py
View
7 nltk/classify/positivenaivebayes.py
@@ -32,8 +32,7 @@
from collections import defaultdict
-from nltk.probability import FreqDist, ConditionalFreqDist, DictionaryProbDist, \
- ELEProbDist
+from nltk.probability import FreqDist, DictionaryProbDist, ELEProbDist
from naivebayes import NaiveBayesClassifier
@@ -54,8 +53,8 @@ def train(positive_featuresets, unlabeled_featuresets, positive_prob_prior=0.5,
:param positive_prob_prior: A prior estimate of the probability of the label
``True`` (default 0.5).
"""
- positive_feature_freqdist = ConditionalFreqDist()
- unlabeled_feature_freqdist = ConditionalFreqDist()
+ positive_feature_freqdist = defaultdict(FreqDist)
+ unlabeled_feature_freqdist = defaultdict(FreqDist)
feature_values = defaultdict(set)
fnames = set()

0 comments on commit b4ff33a

Please sign in to comment.
Something went wrong with that request. Please try again.