code: def assign_word_topics(self, docs):
      (
          _,
          self.kappa,
          _,
          _,
          _,
          self.gamma_i,
          self.topic_word,
      ) = self._get_view(self.params)
  
      for di in range(len(docs)):
          doc = docs[di]
          doc_len = len(doc)
          topics = self.topic_assignment[di]
  
          for wi in range(doc_len):
              old_topic = topics[wi]
              word = doc[wi]
              topic_score = np.exp(
                  self.kappa * self.gamma_i[di]
                  + self.background_word[word]
                  + self.topic_word[word]
              )
              topic_score = topic_score / np.sum(topic_score)
              new_topic = self._sampling_from_dist(topic_score)
              if new_topic != old_topic:
                  self.word_topic_cnt[word, old_topic] -= 1
                  self.word_topic_cnt[word, new_topic] += 1
                  self.topic_cnt[0, old_topic] -= 1
                  self.topic_cnt[0, new_topic] += 1
                  self.item_topic_cnt[di, old_topic] -= 1
                  self.item_topic_cnt[di, new_topic] += 1
                  self.topic_assignment[di][wi] = new_topic
  
      average = self.topic_word.sum(axis=1)[:, np.newaxis] / self.k
      self.topic_word -= average
      self.background_word += average
  
file_path: cornac/cornac/models/hft/hft.py
imports: import numpy
  import scipy.optimize
label_desc: Use image node_id 5 for calling the Model obj's underlying member method code with example usage: obj.assign_word_topics(docs) without return types