def refactor_descriptor(descriptor, type_policy, distance_policy, charge_policy):
    """
    Refactors/discretizes the provided descriptor according to the given policies.
    :param descriptor: molecular descriptor
    :param type_policy: a atom type policy
    :param distance_policy: a distance policy
    :param charge_policy: a charge policy
    :return: the refactored descriptor with feature values discretized
    """
    new_descriptor = []
    for curr_atom_types, curr_distances, curr_partial_charges in descriptor:
        new_atom_types = [type_policy.discretize(a) for a in curr_atom_types]
        new_distances = [distance_policy.discretize(d) for d in curr_distances]
        new_partial_charges = [charge_policy.discretize(c) for c in curr_partial_charges]
        new_descriptor.append((new_atom_types, new_distances, new_partial_charges))

    return new_descriptor