z
This commit is contained in:
parent
11fb2733e5
commit
b69d52b5d7
@ -12,13 +12,11 @@ def process_text(text, nazwisko_user, nazwisko_system):
|
|||||||
def join_lines(text ):
|
def join_lines(text ):
|
||||||
lines = text.split("\n" )
|
lines = text.split("\n" )
|
||||||
joined_lines = [lines[0] ]
|
joined_lines = [lines[0] ]
|
||||||
|
|
||||||
for line in lines[1:] :
|
for line in lines[1:] :
|
||||||
if line.startswith("[") :
|
if line.startswith("[") :
|
||||||
joined_lines.append(line )
|
joined_lines.append(line )
|
||||||
else :
|
else :
|
||||||
joined_lines[-1] += " " + line
|
joined_lines[-1] += " " + line
|
||||||
|
|
||||||
return "\n".join(joined_lines )
|
return "\n".join(joined_lines )
|
||||||
def remove_empty_lines(text):
|
def remove_empty_lines(text):
|
||||||
lines = text.split('\n' )
|
lines = text.split('\n' )
|
||||||
@ -26,14 +24,11 @@ def remove_empty_lines(text):
|
|||||||
for line in lines :
|
for line in lines :
|
||||||
if line.strip():
|
if line.strip():
|
||||||
non_empty_lines.append(line)
|
non_empty_lines.append(line)
|
||||||
|
|
||||||
return '\n'.join(non_empty_lines)
|
return '\n'.join(non_empty_lines)
|
||||||
|
|
||||||
def read_tsv(file_path ):
|
def read_tsv(file_path ):
|
||||||
with open(file_path, 'r', encoding='utf-8') as tsv_file :
|
with open(file_path, 'r', encoding='utf-8') as tsv_file :
|
||||||
content =tsv_file.read()
|
content =tsv_file.read()
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def write_tsv(file_path, content ):
|
def write_tsv(file_path, content ):
|
||||||
with open(file_path, 'w', encoding='utf-8') as tsv_file :
|
with open(file_path, 'w', encoding='utf-8') as tsv_file :
|
||||||
tsv_file.write(content )
|
tsv_file.write(content )
|
||||||
@ -49,7 +44,7 @@ def replace_first_space_with_tab(text):
|
|||||||
new_lines.append(line )
|
new_lines.append(line )
|
||||||
return "\n".join(new_lines )
|
return "\n".join(new_lines )
|
||||||
if __name__ == '__main__' :
|
if __name__ == '__main__' :
|
||||||
# wypelnic przed uruchomieniem
|
# wypelnic przed uruchomieniemm
|
||||||
nazwisko_user =""
|
nazwisko_user =""
|
||||||
nazwisko_system= ""
|
nazwisko_system= ""
|
||||||
numer_user =""
|
numer_user =""
|
||||||
|
Loading…
Reference in New Issue
Block a user