mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
Moved KANJI_MAP to icu-rules
This commit is contained in:
@@ -18,25 +18,6 @@ from nominatim.tokenizer.sanitizers.base import ProcessInfo
|
||||
from nominatim.tokenizer.sanitizers.config import SanitizerConfig
|
||||
from nominatim.data.place_name import PlaceName
|
||||
|
||||
KANJI_MAP = {
|
||||
ord('零'): '0',
|
||||
ord('一'): '1',
|
||||
ord('二'): '2',
|
||||
ord('三'): '3',
|
||||
ord('四'): '4',
|
||||
ord('五'): '5',
|
||||
ord('六'): '6',
|
||||
ord('七'): '7',
|
||||
ord('八'): '8',
|
||||
ord('九'): '9'
|
||||
}
|
||||
|
||||
def convert_kanji_sequence_to_number(sequence: str) -> str:
|
||||
"""Converts Kanji numbers to Arabic numbers
|
||||
"""
|
||||
converted = sequence.translate(KANJI_MAP)
|
||||
return converted
|
||||
|
||||
def create(_: SanitizerConfig) -> Callable[[ProcessInfo], None]:
|
||||
"""Set up the sanitizer
|
||||
"""
|
||||
@@ -49,11 +30,6 @@ def reconbine_housenumber(
|
||||
) -> List[PlaceName]:
|
||||
""" Recombine the tag of housenumber by using housenumber and blocknumber
|
||||
"""
|
||||
if tmp_blocknumber:
|
||||
tmp_blocknumber = convert_kanji_sequence_to_number(tmp_blocknumber)
|
||||
if tmp_housenumber:
|
||||
tmp_housenumber = convert_kanji_sequence_to_number(tmp_housenumber)
|
||||
|
||||
if tmp_blocknumber and tmp_housenumber:
|
||||
new_address.append(
|
||||
PlaceName(
|
||||
@@ -87,11 +63,6 @@ def reconbine_place(
|
||||
) -> List[PlaceName]:
|
||||
""" Recombine the tag of place by using neighbourhood and quarter
|
||||
"""
|
||||
if tmp_neighbourhood:
|
||||
tmp_neighbourhood = convert_kanji_sequence_to_number(tmp_neighbourhood)
|
||||
if tmp_quarter:
|
||||
tmp_quarter = convert_kanji_sequence_to_number(tmp_quarter)
|
||||
|
||||
if tmp_neighbourhood and tmp_quarter:
|
||||
new_address.append(
|
||||
PlaceName(
|
||||
|
||||
Reference in New Issue
Block a user