(target_fn)
| 26 | |
| 27 | |
| 28 | def get_train_test(target_fn): |
| 29 | train_lst = list() |
| 30 | test_lst = list() |
| 31 | with read_file(target_fn, mode="r") as fin: |
| 32 | for indx, item in enumerate(fin): |
| 33 | if item.split("\t")[1] in {"train", "training", "20news-bydate-train"}: |
| 34 | train_lst.append(indx) |
| 35 | else: |
| 36 | test_lst.append(indx) |
| 37 | |
| 38 | return train_lst, test_lst |
| 39 | |
| 40 | |
| 41 | class PrepareData: |