code: def get_key_words(s, max_words=50, weighted=False):
      
      s = _decode(s)
      logger.debug("Searching for up to {}{} key words in: {}.".format(
                   max_words, ' weighted' if weighted else '', s))
      result = nlpir.GetKeyWords(_encode(s), max_words, weighted)
      result = _decode(result)
      logger.debug("Finished key word search: {}.".format(result))
      logger.debug("Formatting key word search results.")
      fresult = result.strip('#').split('#') if result else []
      if weighted:
          weights, words = [], []
          for w in fresult:
              result = w.split('/')
              word, weight = result[0], result[2]
              weight = _to_float(weight)
              weights.append(weight or 0.0)
              words.append(word)
          fresult = zip(words, weights)
          if is_python3:
              # Return a list instead of a zip object in Python 3.
              fresult = list(fresult)
      logger.debug("Key words formatted: {}.".format(fresult))
      return fresult
docs: Determines key words in Chinese text *s*.
  
      The key words are returned in a list. If *weighted* is ``True``,
      then each list item is a tuple: ``(word, weight)``, where
      *weight* is a float. If it's *False*, then each list item is a string.
  
      This uses the function :func:`~pynlpir.nlpir.GetKeyWords` to determine
      the key words in *s*.
  
      :param s: The Chinese text to analyze. *s* should be Unicode or a UTF-8
          encoded string.
      :param int max_words: The maximum number of key words to find (defaults to
          ``50``).
      :param bool weighted: Whether or not to return the key words' weights
          (defaults to ``True``).