Commit
·
ecaa6c5
1
Parent(s):
dd03977
Upload 2 files
Browse files- convert.py +3 -1
- train.csv +1 -0
convert.py
CHANGED
@@ -10,9 +10,11 @@ output_file = 'train.csv'
|
|
10 |
with open(input_file, 'r', encoding='utf-8') as file:
|
11 |
paragraphs = file.read().split('\n\n') # Adjust the split pattern based on your paragraph format
|
12 |
|
13 |
-
# Create a CSV writer and write the combined paragraphs into the CSV file
|
14 |
with open(output_file, 'w', newline='', encoding='utf-8') as csvfile:
|
|
|
15 |
csv_writer = csv.writer(csvfile)
|
|
|
16 |
|
17 |
# Use a loop to combine prompt and continuation in the same column with appropriate tags
|
18 |
for i in range(len(paragraphs)):
|
|
|
10 |
with open(input_file, 'r', encoding='utf-8') as file:
|
11 |
paragraphs = file.read().split('\n\n') # Adjust the split pattern based on your paragraph format
|
12 |
|
13 |
+
# Create a CSV writer and write the combined paragraphs into the CSV file with 'text' as the column header
|
14 |
with open(output_file, 'w', newline='', encoding='utf-8') as csvfile:
|
15 |
+
fieldnames = ['text']
|
16 |
csv_writer = csv.writer(csvfile)
|
17 |
+
csv_writer.writerow(fieldnames)
|
18 |
|
19 |
# Use a loop to combine prompt and continuation in the same column with appropriate tags
|
20 |
for i in range(len(paragraphs)):
|
train.csv
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
"###Human Zon Larangan
|
2 |
Zali belari sekuat yang mungkin. Dadanya turun naik pantas. Menyedut oksigen yang sangat-sangat diperlukan kakinya.
|
3 |
Masakan tidak, sudah hampir 10 minit dia berlari. Kakinya sudahpun hampir lenguh. Dan peluh sudahpun mula turun dari dahinya.
|
|
|
1 |
+
text
|
2 |
"###Human Zon Larangan
|
3 |
Zali belari sekuat yang mungkin. Dadanya turun naik pantas. Menyedut oksigen yang sangat-sangat diperlukan kakinya.
|
4 |
Masakan tidak, sudah hampir 10 minit dia berlari. Kakinya sudahpun hampir lenguh. Dan peluh sudahpun mula turun dari dahinya.
|