Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2015-07-27 16:07:00 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:58:10 +0300
commita9cbd5e17b7df60d17e6d9321fa67f0956e1e6b8 (patch)
tree6ddac5ae28dad13a48c6da82a8833f936990af7e /sound
parent1729c30fcb8bd453b7c612790a0929de61f35757 (diff)
Exchanging all non-breaking spaces into spaces.
Diffstat (limited to 'sound')
-rwxr-xr-xsound/tts/sound_csv_to_sound_txt.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/tts/sound_csv_to_sound_txt.py b/sound/tts/sound_csv_to_sound_txt.py
index 67a8a6236d..a0f7610f7f 100755
--- a/sound/tts/sound_csv_to_sound_txt.py
+++ b/sound/tts/sound_csv_to_sound_txt.py
@@ -17,6 +17,7 @@ def parse_args():
+ "https://docs.google.com/spreadsheets/d/1gJsSzFpp2B3xnSx-RjjQ3Do66lQDhCxtfEnQo7Vrkw0/edit#gid=150382014\n"
+ "The output shall be put to omim/sound/tts/sound.txt. As another output file the tool generates languages.txt."
+ "languages.txt contains all available languages in csv.\n"
+ + "Notice. The script exchanges all non-breaking spaces with spaces.\n"
+ "Example: python %prog path_to_sound.csv path_to_sound.txt path_to_languages.txt",
version="%prog 1.0")
@@ -27,6 +28,10 @@ def parse_args():
return args
+def nbsp_to_spaces(str):
+ return str.replace('\xc2\xa0', ' ')
+
+
def run():
csv_name, twine_name, languages_name = parse_args()
@@ -54,10 +59,11 @@ def run():
# Translation follows starting from the 4th line in the table.
for row in csv_reader:
if row[ID_COLUMN]:
- twine_file.write(' [{section}]\n'.format(section=row[ID_COLUMN]))
+ twine_file.write(' [{section}]\n'.format(section = nbsp_to_spaces(row[ID_COLUMN])))
for column_idx, translation in enumerate(row):
if (MIN_PROCESSED_COLUMN <= column_idx < MAX_PROCESSED_COLUMN and column_idx in languages.keys()):
- twine_file.write(' {lang} = {trans}\n'.format(lang = languages[column_idx], trans = translation))
+ twine_file.write(' {lang} = {trans}\n'.format(lang = languages[column_idx],
+ trans = nbsp_to_spaces(translation)))
twine_file.write('\n')
print('Done. Check {twine} and {lang} for the result.\n'.format(twine = twine_name, lang = languages_name))