code: def compact(self, term_doc_matrix):
  		'''
  		Parameters
  		----------
  		term_doc_matrix : TermDocMatrix
  			Term document matrix object to compact
  
  		Returns
  		-------
  		New term doc matrix
  		'''
  		domain_mat = CombineDocsIntoDomains(term_doc_matrix).get_new_term_doc_mat(self.doc_domains)
  		domain_count = (domain_mat > 0).sum(axis=0)
  		valid_term_mask = (self.max_domain_count >= domain_count) \
  		                  & (domain_count >= self.min_domain_count)
  		indices_to_compact = np.arange(term_doc_matrix.get_num_terms())[~valid_term_mask.A1]
  		return term_doc_matrix.remove_terms_by_indices(indices_to_compactf compact(self, term_doc_matrix):
  		'''
  		Parameters
  		----------
  		term_doc_matrix : TermDocMatrix
  			Term document matrix object to compact
  
  		Returns
  		-------
  		New term doc matrix
  		'''
  		domain_mat = CombineDocsIntoDomains(term_doc_matrix).get_new_term_doc_mat(self.doc_domains)
  		domain_count = (domain_mat > 0).sum(axis=0)
  		valid_term_mask = (self.max_domain_count >= domain_count) \
  		                  & (domain_count >= self.min_domain_count)
  		indices_to_compact = np.arange(term_doc_matrix.get_num_terms())[~valid_term_mask.A1]
  		return term_doc_matrix.remove_terms_by_indices(indices_to_compact)
docs: Parameters
  		----------
  		term_doc_matrix : TermDocMatrix
  			Term document matrix object to compact
  
  		Returns
  		-------
  		New term doc matrix