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: Calculate id of the given token.
  Also keep track of what words were mapped to what ids, if `debug=True` was set in the constructor.
  
  Parameters
  ----------
  token : str
      Input token.
  
  Return
  ------
  int
      Hash value of `token`.
docstr_tok: ["Calculate","id","of","the","given","token",".","Also","keep","track","of","what","words","were","mapped","to","what","ids",",","if","`","debug=True","`","was","set","in","the","constructor",".","Parameters","--","--","--","--","--","token",":","str","Input","token",".","Return","--","--","--","int","Hash","value","of","`","token","`","."]
code: def restricted_hash(self, token):
      """Calculate id of the given token.
      Also keep track of what words were mapped to what ids, if `debug=True` was set in the constructor.
  
      Parameters
      ----------
      token : str
          Input token.
  
      Return
      ------
      int
          Hash value of `token`.
  
      """
      h = self.myhash(utils.to_utf8(token)) % self.id_range
      if self.debug:
          self.token2id[token] = h
          self.id2token.setdefault(h, set()).add(token)
      return h
  
file_path: gensim/gensim/corpora/hashdictionary.py
imports: import logging
  import itertools
  import zlib
  from gensim import utils
label_desc: Use image node_id 3 for calling the HashDictionary obj's underlying member method code with example usage: obj.restricted_hash(token) and returns: h