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: Parameters
  ----------
  documents : iterable of iterable of str, optional
      Iterable of documents. If given, used to collect additional corpus statistics.
      :class:`~gensim.corpora.hashdictionary.HashDictionary` can work
      without these statistics (optional parameter).
  id_range : int, optional
      Number of hash-values in table, used as `id = myhash(key) %% id_range`.
  myhash : function, optional
      Hash function, should support interface `myhash(str) -> int`, uses `zlib.adler32` by default.
  debug : bool, optional
      Store which tokens have mapped to a given id? **Will use a lot of RAM**.
      If you find yourself running out of memory (or not sure that you really need raw tokens),
      keep `debug=False`.
docstr_tok: ["Parameters","--","--","--","--","--","documents",":","iterable","of","iterable","of","str",",","optional","Iterable","of","documents",".","If","given",",","used","to","collect","additional","corpus","statistics",".",":","class",":","`","~gensim.corpora.hashdictionary.HashDictionary","`","can","work","without","these","statistics","(","optional","parameter",")",".","id_range",":","int",",","optional","Number","of","hash-values","in","table",",","used","as","`","id","=","myhash","(","key",")","%","%","id_range","`",".","myhash",":","function",",","optional","Hash","function",",","should","support","interface","`","myhash","(","str",")","-",">","int","`",",","uses","`","zlib.adler32","`","by","default",".","debug",":","bool",",","optional","Store","which","tokens","have","mapped","to","a","given","id","?","*","*","Will","use","a","lot","of","RAM","*","*",".","If","you","find","yourself","running","out","of","memory","(","or","not","sure","that","you","really","need","raw","tokens",")",",","keep","`","debug=False","`","."]
code: def __init__(
      self,
      documents=None,
      id_range=32000,
      myhash=zlib.adler32,
      debug=True,
  ):
      """
  
      Parameters
      ----------
      documents : iterable of iterable of str, optional
          Iterable of documents. If given, used to collect additional corpus statistics.
          :class:`~gensim.corpora.hashdictionary.HashDictionary` can work
          without these statistics (optional parameter).
      id_range : int, optional
          Number of hash-values in table, used as `id = myhash(key) %% id_range`.
      myhash : function, optional
          Hash function, should support interface `myhash(str) -> int`, uses `zlib.adler32` by default.
      debug : bool, optional
          Store which tokens have mapped to a given id? **Will use a lot of RAM**.
          If you find yourself running out of memory (or not sure that you really need raw tokens),
          keep `debug=False`.
  
      """
      self.myhash = myhash  # hash fnc: string->integer
      self.id_range = (
          id_range  # hash range: id = myhash(key) % id_range
      )
      self.debug = debug
  
      # the following (potentially massive!) dictionaries are only formed if `debug` is True
      self.token2id = {}
      self.id2token = {}  # reverse mapping int->set(words)
      self.dfs = (
          {}
      )  # token_id -> how many documents this token_id appeared in
      self.dfs_debug = (
          {}
      )  # token_string->how many documents this word appeared in
  
      self.num_docs = 0  # number of documents processed
      self.num_pos = 0  # total number of corpus positions
      self.num_nnz = 0  # total number of non-zeroes in the BOW matrix
      self.allow_update = True
  
      if documents is not None:
          self.add_documents(documents)
  
file_path: gensim/gensim/corpora/hashdictionary.py
imports: import logging
  import itertools
  import zlib
  from gensim import utils
label_desc: Use image node_id 1 to create a new HashDictionary object from inherited base classes: utils, dict with example: obj = HashDictionary(documents, id_range, myhash, debug)