def restricted_hash(self, token):
    'Calculate id of the given token.\n        Also keep track of what words were mapped to what ids, for debugging reasons.\n\n        Parameters\n        ----------\n        token : str\n            Input token.\n\n        Return\n        ------\n        int\n            Hash value of `token`.\n\n        '
    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
Calculate id of the given token.
Also keep track of what words were mapped to what ids, for debugging reasons.

Parameters
----------
token : str
    Input token.

Return
------
int
    Hash value of `token`.
def restricted_hash(self, token):
    'Calculate id of the given token.\n        Also keep track of what words were mapped to what ids, for debugging reasons.\n\n        Parameters\n        ----------\n        token : str\n            Input token.\n\n        Return\n        ------\n        int\n            Hash value of `token`.\n\n        '
    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