예제 #1
0
 def add_theme(self):
     url_theme = []
     if self.title:
         text = ' '.join([self.title])
         text = TextCleaner.clean_text_for_analysis(text)
         for theme, theme_words in zip(self.dict_theme.keys(),
                                       self.dict_theme.values()):
             in_list = any(
                 TextCleaner.string_in_text(s, text) for s in theme_words)
             if in_list:
                 url_theme.append(theme)
     self.theme = url_theme
예제 #2
0
    def add_theme(self):
        url_theme = []
        title = self.title if self.title else ''
        description = self.description if self.description else ''

        text = ' '.join([title, description])
        text = TextCleaner.clean_text_for_analysis(text)
        for theme, theme_words in zip(self.dict_theme.keys(),
                                      self.dict_theme.values()):
            in_list = any(
                TextCleaner.string_in_text(s, text) for s in theme_words)
            if in_list:
                url_theme.append(theme)
        self.theme = url_theme