Closed joto closed 2 years ago
This line is problematic, because w['hepburn'] can be empty.
w['hepburn']
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'}]
ローソン 野々市本町西店
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.
This line is problematic, because
w['hepburn']
can be empty.Example:
ローソン 野々市本町西店
results inkanji=[{'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.