def load_params(params_filepath):
    """Load parameter dict from file (tab separated)."""
    params = {}
    with open(params_filepath, 'r', encoding='utf-8') as params_str:
        for line in params_str:
            line = line.strip()
            items = line.split('\t')
            if items[0] in ['shuffle', 'cuda', 'reverse']:
                params[items[0]] = items[1] == 'True'
            elif items[0] in ['max_seq_len', 'min_count']:
                params[items[0]] = int(items[1])
            else:
                raise Exception('Unsupported dataset parameter: {}'
                                .format(items[0]))
    return params