class_docstr: Mapping between words and their integer ids, using a hashing function.
  
  Unlike :class:`~gensim.corpora.dictionary.Dictionary`,
  building a :class:`~gensim.corpora.hashdictionary.HashDictionary` before using it **isn't a necessary step**.
  
  You can start converting words to ids immediately, without training on a corpus.
  
  Examples
  --------
  .. sourcecode:: pycon
  
      >>> from gensim.corpora import HashDictionary
      >>>
      >>> dct = HashDictionary(debug=False)  # needs no training corpus!
      >>>
      >>> texts = [['human', 'interface', 'computer']]
      >>> dct.doc2bow(texts[0])
      [(10608, 1), (12466, 1), (31002, 1)]
class_docstr_tok: ["Mapping","between","words","and","their","integer","ids",",","using","a","hashing","function",".","Unlike",":","class",":","`","~gensim.corpora.dictionary.Dictionary","`",",","building","a",":","class",":","`","~gensim.corpora.hashdictionary.HashDictionary","`","before","using","it","*","*","is","n't","a","necessary","step","*","*",".","You","can","start","converting","words","to","ids","immediately",",","without","training","on","a","corpus",".","Examples","--","--","--","--","..","sourcecode",":",":","pycon",">",">",">","from","gensim.corpora","import","HashDictionary",">",">",">",">",">",">","dct","=","HashDictionary","(","debug=False",")","#","needs","no","training","corpus","!",">",">",">",">",">",">","texts","=","[","[","'human","'",",","'interface","'",",","'computer","'","]","]",">",">",">","dct.doc2bow","(","texts","[","0","]",")","[","(","10608",",","1",")",",","(","12466",",","1",")",",","(","31002",",","1",")","]"]
docstr: Save the debug token=>id mapping to a text file.
  
  Warnings
  --------
  Only makes sense when `debug=True`, for debugging.
  
  Parameters
  ----------
  fname : str
      Path to output file.
  
  Notes
  -----
  The format is:
  `id[TAB]document frequency of this id[TAB]tab-separated set of words in UTF8 that map to this id[NEWLINE]`.
  
  
  Examples
  --------
  .. sourcecode:: pycon
  
      >>> from gensim.corpora import HashDictionary
      >>> from gensim.test.utils import get_tmpfile
      >>>
      >>> corpus = [["máma", "mele", "maso"], ["ema", "má", "máma"]]
      >>> data = HashDictionary(corpus)
      >>> data.save_as_text(get_tmpfile("dictionary_in_text_format"))
docstr_tok: ["Save","the","debug","token=",">","id","mapping","to","a","text","file",".","Warnings","--","--","--","--","Only","makes","sense","when","`","debug=True","`",",","for","debugging",".","Parameters","--","--","--","--","--","fname",":","str","Path","to","output","file",".","Notes","--","--","-","The","format","is",":","`","id","[","TAB","]","document","frequency","of","this","id","[","TAB","]","tab-separated","set","of","words","in","UTF8","that","map","to","this","id","[","NEWLINE","]","`",".","Examples","--","--","--","--","..","sourcecode",":",":","pycon",">",">",">","from","gensim.corpora","import","HashDictionary",">",">",">","from","gensim.test.utils","import","get_tmpfile",">",">",">",">",">",">","corpus","=","[","[","``","m\u00e1ma","''",",","``","mele","''",",","``","maso","''","]",",","[","``","ema","''",",","``","m\u00e1","''",",","``","m\u00e1ma","''","]","]",">",">",">","data","=","HashDictionary","(","corpus",")",">",">",">","data.save_as_text","(","get_tmpfile","(","``","dictionary_in_text_format","''",")",")"]
code: def save_as_text(self, fname):
      """Save the debug token=>id mapping to a text file.
  
      Warnings
      --------
      Only makes sense when `debug=True`, for debugging.
  
      Parameters
      ----------
      fname : str
          Path to output file.
  
      Notes
      -----
      The format is:
      `id[TAB]document frequency of this id[TAB]tab-separated set of words in UTF8 that map to this id[NEWLINE]`.
  
  
      Examples
      --------
      .. sourcecode:: pycon
  
          >>> from gensim.corpora import HashDictionary
          >>> from gensim.test.utils import get_tmpfile
          >>>
          >>> corpus = [["máma", "mele", "maso"], ["ema", "má", "máma"]]
          >>> data = HashDictionary(corpus)
          >>> data.save_as_text(get_tmpfile("dictionary_in_text_format"))
  
      """
      logger.info("saving %s mapping to %s" % (self, fname))
      with utils.open(fname, "wb") as fout:
          for tokenid in self.keys():
              words = sorted(self[tokenid])
              if words:
                  words_df = [
                      (word, self.dfs_debug.get(word, 0))
                      for word in words
                  ]
                  words_df = [
                      "%s(%i)" % item
                      for item in sorted(words_df, key=lambda x: -x[1])
                  ]
                  words_df = "\t".join(words_df)
                  fout.write(
                      utils.to_utf8(
                          "%i\t%i\t%s\n"
                          % (
                              tokenid,
                              self.dfs.get(tokenid, 0),
                              words_df,
                          )
                      )
                  )
  
file_path: gensim/gensim/corpora/hashdictionary.py
imports: import logging
  import itertools
  import zlib
  from gensim import utils
label_desc: Use image node_id 11 for calling the HashDictionary obj's underlying member method code with example usage: obj.save_as_text(fname) without return types