Add CSV to Pipe delimited. Add corpus texts
This commit is contained in:
18
CSVToPipeDelimted.py
Normal file
18
CSVToPipeDelimted.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import csv
|
||||
|
||||
# Converts a CSV file to | delimted
|
||||
# use for incorporating data into RAG system
|
||||
|
||||
input_file = "input.csv"
|
||||
output_file = "output.txt"
|
||||
|
||||
with open(input_file, newline='', encoding='utf-8') as csvfile, \
|
||||
open(output_file, 'w', newline='', encoding='utf-8') as outfile:
|
||||
|
||||
reader = csv.reader(csvfile)
|
||||
writer = csv.writer(outfile, delimiter='|')
|
||||
|
||||
for row in reader:
|
||||
writer.writerow(row)
|
||||
|
||||
print("Conversion complete.")
|
||||
Reference in New Issue
Block a user