Abstract
Grapheme-to-Phoneme (G2P) conversion is a critical component of Text-to-Speech (TTS) systems, yet it remains challenging for languages like Thai due to complex orthography and the absence of word delimiters. While modern neural models achieve high accuracy, they often produce "hallucinated" errors that are linguistically impossible. This paper presents a hybrid G2P system that combines a rule-based candidate generation lattice with a neural regression model for scoring. Our approach maintains high accuracy (93.1%) while significantly reducing worst-case errors, ensuring that all outputs remain linguistically valid.
Introduction
The conversion of written text (graphemes) into phonetic representations (phonemes) is fundamental for high-quality speech synthesis. In Thai, this task is complicated by the lack of spaces between words and context-dependent pronunciations. Standard "black-box" sequence-to-sequence models, such as Transformers, are prone to reliability issues, sometimes generating nonsensical or repetitive phoneme sequences. To address this, we propose a system that constrains the neural model's output to a set of linguistically valid candidates generated by a rule-based engine.
Methodology
Our system operates in two distinct phases: candidate generation and neural scoring.
Candidate Generation (The Lattice)
Instead of generating phonemes from scratch, we employ a rule-based program (approximately 300 lines) based on Thai orthography. This program generates a "lattice" representing all linguistically possible pronunciations for a given input string. This constraint ensures that the final output is always a valid Thai syllable sequence.
Neural Scoring (The Regression)
We utilize a bi-directional Gated Recurrent Unit (Bi-GRU) architecture to score each candidate in the lattice. Unlike traditional classification models, our system treats G2P as a regression task. The model predicts a similarity score (0 to 1) for each candidate, calculated using a normalized edit distance against the ground truth.
The model processes both the original grapheme sequence (V) and the candidate phoneme sequence (C). At inference, the candidate with the highest predicted similarity score is selected as the final pronunciation.
Experimental Setup
The model was evaluated on two datasets:
- Thai Dataset: 18,066 entries from Wiktionary, with an average length of 7.4 characters.
- Japanese Dataset: 10,000 Hiragana entries from the SIGMORPHON 2021 dataset to test cross-linguistic generalizability.
The proposed model is lightweight, containing 1.17 million parameters, and efficient to train.
Results and Discussion
The proposed method was compared against three baselines: a Finite State Transducer (FST), a standard Encoder-Decoder (Enc-Dec), and a Transformer (Xformer).
As shown in the results, our model achieved an accuracy of 93.1%, comparable to the Encoder-Decoder. However, the most significant improvement is in the "Max Difference" metric, which measures the worst-case error. Our model's maximum error was only 8.7, whereas the Encoder-Decoder and Transformer reached 78.9 and 42.5, respectively. This demonstrates that our hybrid approach effectively eliminates the "hallucination" problem common in pure neural architectures.
On the Japanese dataset, our model outperformed all baselines with 94.5% accuracy, suggesting strong generalizability.
Conclusion
By combining linguistic constraints with neural regression, we have developed a G2P system for Thai that is both accurate and reliable. The use of a rule-based lattice acts as a safety net, preventing the model from generating illegal phoneme sequences. Future work will focus on optimizing lattice traversal for longer phrases to improve computational efficiency.
Summary updated