giggls / osml10n

Localization functions for Openstreetmap
https://tile.openstreetmap.de
GNU General Public License v3.0
15 stars 7 forks source link

Empty string with hepburn #7

Closed joto closed 2 years ago

joto commented 2 years ago

This line is problematic, because w['hepburn'] can be empty.

Example: ローソン 野々市本町西店 results in kanji=[{'orig': 'ローソン', 'hira': 'ろーそん', 'kana': 'ローソン', 'hepburn': 'rooson', 'kunrei': 'rooson', 'passport': 'rooson'}, {'orig': ' ', 'hira': ' ', 'kana': ' ', 'hepburn': '', 'kunrei': ' ', 'passport': ' '}, {'orig': '野々市', 'hira': 'ののいち', 'kana': 'ノノイチ', 'hepburn': 'nonoichi', 'kunrei': 'nonoiti', 'passport': 'nonoichi'}, {'orig': '本町', 'hira': 'ほんちょう', 'kana': 'ホンチョウ', 'hepburn': 'honchou', 'kunrei': 'hontyou', 'passport': 'honcho'}, {'orig': '西', 'hira': 'にし', 'kana': 'ニシ', 'hepburn': 'nishi', 'kunrei': 'nisi', 'passport': 'nishi'}, {'orig': '店', 'hira': 'みせ', 'kana': 'ミセ', 'hepburn': 'mise', 'kunrei': 'mise', 'passport': 'mise'}]

So it seems the empty space between words appears an empty string in the results array.