def update_word_stats(sender, instance, created, using, **kwargs): if not created: return text = ''.join((instance.content_ascii, instance.subject_title_ascii)) text = unicode_to_ascii(text).lower() for word, count in count_words(text): Word.objects.increase_count(word, count)
def word_stats(self): text = ' '.join([self.subject_title_ascii or "", self.content_ascii or ""]).lower() count = count_words(text, r"[a-z0-9]{2}[a-zA-Z0-9]*") return count
def word_stats(self): text = ' '.join( [self.subject_title_ascii or "", self.content_ascii or ""]).lower() count = count_words(text, r"[a-z0-9]{2}[a-zA-Z0-9]*") return count