From f2313a6e0845db4ff3ebe2cd29c632db3d77dec7 Mon Sep 17 00:00:00 2001 From: henrynguyen0x <56329400+henrynguyen0x@users.noreply.github.com> Date: Thu, 1 Dec 2022 15:19:56 +0000 Subject: [PATCH] Update encoding Add encoding utf-8 for file to avoid charmap error --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index c6cabac..bac8f92 100644 --- a/main.py +++ b/main.py @@ -58,7 +58,7 @@ def split_into_sentences(text): def get_book_sentences(): """Get the book file, and tokenize it.""" - text = open('caesar-and-christ.txt').read() + text = open('caesar-and-christ.txt', encoding = "utf-8").read() sentences = split_into_sentences(text) return sentences[5004:10000] # TODO: generalize this