code: def __word_proposal(self, doc, token, old_topic):
      if isinstance(doc, LDADoc) and isinstance(token, Token):
          new_topic = self.__propose(token.id)
          if new_topic != old_topic:
              proposal_old = self.__word_proposal_distribution(
                  token.id, old_topic
              )
              proposal_new = self.__word_proposal_distribution(
                  token.id, new_topic
              )
              proportion_old = self.__proportional_function(
                  doc, token, old_topic
              )
              proportion_new = self.__proportional_function(
                  doc, token, new_topic
              )
              transition_prob = float(
                  (proportion_new * proposal_old)
                  / (proportion_old * proposal_new)
              )
              rejection = rand()
              mask = -(rejection < transition_prob)
              return (new_topic & mask) | (old_topic & ~mask)
          return new_topic
  
      elif isinstance(doc, SLDADoc) and isinstance(token, Sentence):
          sent = token
          new_topic = old_topic
          for word_id in sent.tokens:
              new_topic = self.__propose(word_id)
              if new_topic != old_topic:
                  proportion_old = self.__proportional_function(
                      doc, sent, old_topic
                  )
                  proportion_new = self.__proportional_function(
                      doc, sent, new_topic
                  )
                  proposal_old = self.__word_proposal_distribution(
                      word_id, old_topic
                  )
                  proposal_new = self.__word_proposal_distribution(
                      word_id, new_topic
                  )
                  transition_prob = float(
                      (proportion_new * proposal_old)
                      / (proportion_old * proposal_new)
                  )
                  rejection = rand()
                  mask = -(rejection < transition_prob)
                  new_topic = (new_topic & mask) | (old_topic & ~mask)
          return new_topic
  
imports: import os
  import numpy
  from tqdm import tqdm
  from paddlehub.common.logger import logger
  from slda_news.document import LDADoc, SLDADoc, Token, Sentence
  from slda_news.vose_alias import VoseAlias
  from slda_news.util import rand, rand_k
label_desc: Use image node_id 7 for calling the MHSampler obj's underlying member method code with example usage: obj.__word_proposal(doc, token, old_topic) and returns: new_topic, unknown, new_topic