Skip to content

Commit

Permalink
small fixes to script
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Sep 16, 2024
1 parent 7fe4e32 commit c74e051
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/tools/fix_grammar_gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_chunk_length(chunk: List[str]) -> int:

fmt.note(f"Created {len(chunks)} chunks")

fixed_chunks: List[List[str]] = []
fixed_chunks: List[str] = []
for chunk in chunks:
client = OpenAI()
response = client.chat.completions.create(
Expand All @@ -125,8 +125,9 @@ def get_chunk_length(chunk: List[str]) -> int:

with open(file_path, "w", encoding="utf-8") as f:
for c in fixed_chunks:
f.writelines(c)
f.writelines([""] * 2)
f.write(c)
f.write("\n")
f.write("\n")

if count == 0:
fmt.warning("No files selected for grammar check.")
Expand Down

0 comments on commit c74e051

Please sign in to comment.