-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert.py
More file actions
23 lines (18 loc) · 754 Bytes
/
convert.py
File metadata and controls
23 lines (18 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def combine_sentences(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Combine all sentences into a single document
combined_document = ""
for line in lines:
# Remove the timestamps and extra spaces
if '->' in line:
sentence = line.split('] ')[1].strip()
combined_document += sentence + " "
return combined_document.strip()
# Path to the output.txt file
file_path = 'transcription_result9.txt'
# Combine sentences and print the result
document = combine_sentences(file_path)
# Optionally, write the combined document to a new file
with open('combined_document9.txt', 'w', encoding='utf-8') as output_file:
output_file.write(document)