code: def use_categories_as_metadata_and_replace_terms(self):
          '''
          Returns a TermDocMatrix which is identical to self except the metadata values are now identical to the
           categories present and term-doc-matrix is now the metadata matrix.
  
          :return: TermDocMatrix
          '''
          new_metadata_factory = CSRMatrixFactory()
          for i, category_idx in enumerate(self.get_category_ids()):
              new_metadata_factory[i, category_idx] = 1
          new_metadata = new_metadata_factory.get_csr_matrix()
          new_tdm = self._make_new_term_doc_matrix(self._mX,
                                                   new_metadata,
                                                   self._y,
                                                   self._metadata_idx_store,
                                                   self._category_idx_store,
                                                   copy(self._category_idx_store),
                                                   self._y == self._y)
          return new_tdf use_categories_as_metadata_and_replace_terms(self):
          '''
          Returns a TermDocMatrix which is identical to self except the metadata values are now identical to the
           categories present and term-doc-matrix is now the metadata matrix.
  
          :return: TermDocMatrix
          '''
          new_metadata_factory = CSRMatrixFactory()
          for i, category_idx in enumerate(self.get_category_ids()):
              new_metadata_factory[i, category_idx] = 1
          new_metadata = new_metadata_factory.get_csr_matrix()
          new_tdm = self._make_new_term_doc_matrix(self._mX,
                                                   new_metadata,
                                                   self._y,
                                                   self._metadata_idx_store,
                                                   self._category_idx_store,
                                                   copy(self._category_idx_store),
                                                   self._y == self._y)
          return new_tdm
docs: Returns a TermDocMatrix which is identical to self except the metadata values are now identical to the
           categories present and term-doc-matrix is now the metadata matrix.
  
          :return: TermDocMatrix