You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 733 B

123456789101112131415161718192021222324
  1. import os
  2. from os.path import exists
  3. def get_data_path(mode, label_type):
  4. paths = {}
  5. if mode == 'train':
  6. paths['train'] = 'data/' + label_type + '/bert.train.jsonl'
  7. paths['val'] = 'data/' + label_type + '/bert.val.jsonl'
  8. else:
  9. paths['test'] = 'data/' + label_type + '/bert.test.jsonl'
  10. return paths
  11. def get_rouge_path(label_type):
  12. if label_type == 'others':
  13. data_path = 'data/' + label_type + '/bert.test.jsonl'
  14. else:
  15. data_path = 'data/' + label_type + '/test.jsonl'
  16. dec_path = 'dec'
  17. ref_path = 'ref'
  18. if not exists(ref_path):
  19. os.makedirs(ref_path)
  20. if not exists(dec_path):
  21. os.makedirs(dec_path)
  22. return data_path, dec_path, ref_path