code: def feature_hash(feature, dim, seed=123):
      
      vec = np.zeros(dim)
      i = mmh3.hash(feature, seed) % dim
      vec[i] = 1
      return vec
docs: Feature hashing.
  
      Args:
          feature (str): Target feature represented as string.
          dim (int): Number of dimensions for a hash value.
          seed (float): Seed of a MurmurHash3 hash function.
  
      Returns:
          numpy 1d array: one-hot-encoded feature vector for `s`.