INNER CODE UNIT · Python
write_csv_entry
cognitivetech/ollama-ebook-summary · sum.py:221
def write_csv_entry(writer, unique_title: str, text: str, summary: str, elapsed_time: float, is_chapter: bool, heading_level: int):
"""Write entry with the specified format."""
# Replace newlines with escaped newlines
escaped_summary = summary.replace('\n', '\\n')
writer.writerow([
is_chapter,
heading_level,
unique_title,
text,
len(text),
escaped_summary,
len(summary),
elapsed_time
])
# -----------------------------
# Processing Logic
# -----------------------------