コード例 #1
0
 def _stringGain(self, string):
     goodFrequency = TextHelpers.countstringoccurencesinword(
         string, self._goodText)
     badFrequency = TextHelpers.countstringoccurencesinword(
         string, self._badText)
     if badFrequency == 0:
         badFrequency = 0.1 / self._badWordCount
     gain = goodFrequency / badFrequency
     return gain
コード例 #2
0
 def CountOccurrences(self, text):
     return TextHelpers.countstringoccurencesinword(self._string, text)