from .langtable import build_langtable_dataset, build_langtable_slots_dataset, build_langtable_inst_dataset
from .langtable_action import build_langtable_action_dataset, build_langtable_action_slots_dataset

def build_dataset(params, val_only=False):
    dst = params.dataset
    if 'physion' not in dst:
        return eval(f'build_{dst}_dataset')(params, val_only=val_only)
    # physion dataset looks like 'physion_xxx_$SUBSET'
    return eval(f"build_{dst[:dst.rindex('_')]}_dataset")(
        params, val_only=val_only)
