def convert_to_ids(dataset, vocabulary):
    """Convert tokens to integers.
    :param dataset a 2-d array, contains sequences of tokens
    :param vocabulary a map from tokens to unique ids
    :returns a 2-d arrays, contains sequences of unique ids (integers)
    """
    return [[vocabulary[token] for token in sample] for sample in dataset]