1. Leonardo Lazzaro
  2. nltk-extras

Commits

Leonardo Lazzaro  committed a3ca60d

fix bug if any keys is None sum breaks

  • Participants
  • Parent commits 837f041
  • Branches default

Comments (0)

Files changed (1)

File nltk_extras/probability.py

View file
  • Ignore whitespace
 
 	def N(self):
 		if not self._N:
-			self._N = sum(count for count in self.itervalues())
+			self._N = sum(count or 0 for count in self.itervalues())
 		return self._N
 
 	def inc(self, sample, count=1):