def fast_replace(data, keys, values, skip_checks=False):
    assert np.allclose(keys.shape, values.shape)
    if not skip_checks:
        msg = "data has elements not in keys"
        assert data.max() <= keys.max(), msg
    sdx = np.argsort(keys)
    keys, values = keys[sdx], values[sdx]
    idx = np.digitize(data, keys, right=True)
    new_data = values[idx]
    return new_data
Do a search-and-replace in array `data`.
dataset/ETHPy150Open cemoody/lda2vec/lda2vec/corpus.py/fast_replace