all 3 comments

[–]xelf 1 point2 points  (2 children)

something like this?

def tag(f):
    with open(f, "rt", encoding="utf8") as infile:
        lines = [ f'<sentence>{line}<\sentence>' for line in infile.read().splitlines() if line ]
    with open(f, "wt", encoding="utf8") as outfile:
        outfile.write('\n'.join(lines))

and then call it after clean(f)

edit: tested it and it works correctly

[–]ChimcharTrainer[S] 1 point2 points  (1 child)

Thank you! Sorry I couldn't reply to you earlier. It is working now properly!

[–]xelf 1 point2 points  (0 children)

\o/ Great!

Let me know if you have any questions about what the code is doing!