From 52942dce4933671ccbee085c8f91f938d418a8f4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 10 Jan 2026 16:27:41 +0000
Subject: [PATCH 1/2] Initial plan
From 621e15d165d41db75121cd4cc7a9916e6cc00ceb Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 10 Jan 2026 16:32:38 +0000
Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20Replace=20=E0=B8=85=20with=20?=
=?UTF-8?q?=E0=B8=84=20in=20tltk=20transliterate=20functions=20to=20avoid?=
=?UTF-8?q?=20KeyError?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
---
pythainlp/transliterate/tltk.py | 6 ++++++
tests/extra/testx_transliterate.py | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/pythainlp/transliterate/tltk.py b/pythainlp/transliterate/tltk.py
index 12da6c25c..16581b800 100644
--- a/pythainlp/transliterate/tltk.py
+++ b/pythainlp/transliterate/tltk.py
@@ -16,15 +16,21 @@ def romanize(text: str) -> str:
:return: A string of Thai words rendered in the Latin alphabet.
:rtype: str
"""
+ # Replace ฅ with ค to avoid KeyError in tltk (out-of-vocabulary issue)
+ text = text.replace("ฅ", "ค")
_temp = th2roman(text)
return _temp[: _temp.rfind(" ")].replace("", "")
def tltk_g2p(text: str) -> str:
+ # Replace ฅ with ค to avoid KeyError in tltk (out-of-vocabulary issue)
+ text = text.replace("ฅ", "ค")
_temp = g2p(text).split("