amir-zeldes/DepEdit

Deleted newlines

Closed this issue · 3 comments

I am using DepEdit to modify the .conllu files in English-EWT. One annoyance is that those files end with a blank line that DepEdit deletes. I can hack it to add a newline at the end, but should it support this in a more principled way (e.g. preserve all blank lines outside sentences that are seen in the input)?

The intended behavior as I recall is to leave the trailing lines the way they were in the input, under the assumption that it's the users business how many blank lines they want. Can you give me the scenario you are running so I can debug? Is it a glob pattern from the command line, under Python 3.x?

A glob pattern, yes. Either version of Python. Adding + "\n" to

return "\n".join(output_lines)

is a hack that works to add a blank line at the end.

Actually, maybe that's not a hack but the correct behavior: since all the contents of output_lines have whitespace stripped off, the last input line will be missing its final \n.