sane-tag-music: better romanization
This commit is contained in:
@@ -148,6 +148,7 @@ class MediaType(Enum):
|
||||
Other = "other"
|
||||
|
||||
def maybe_romanize(a: str) -> str|None:
|
||||
if a == "( ͡° ͜ʖ ͡°)": return "Lenny"
|
||||
if a == "かめりあ": return "Camellia"
|
||||
if a == "お握り": return "onigiri"
|
||||
if a == "存流": return "ARU"
|
||||
@@ -172,7 +173,12 @@ def romanize(a: str) -> str:
|
||||
romanized = ""
|
||||
index = 0
|
||||
while index < len(a):
|
||||
for segment_len in range(10, 0, -1):
|
||||
if a[index].lower() in "abcdefghijklmnopqrstuvwxyz0123456789._-":
|
||||
# fast path
|
||||
romanized += a[index]
|
||||
index += 1
|
||||
continue
|
||||
for segment_len in range(16, 0, -1):
|
||||
r = maybe_romanize(a[index : index+segment_len])
|
||||
if r is not None:
|
||||
if len(r) > 1:
|
||||
|
Reference in New Issue
Block a user