12345678 |
- def write_to_clf(clf_data, save_file):
- # Save dataset for text classification to file.
- """
- clf_data: List[List[str]] [[text1, label1],[text2,label2]...]
- file format: tsv, row: text + tab + label
- """
- with open(save_file, 'w', encoding='utf-8') as f:
- f.writelines("\n".join(["\t".join(str(r) for r in row) for row in clf_data]))
|