Hierarchical Transformer Encoders for Vietnamese Spelling Correction

Hieu Tran, Cuong V. Dinh, Long Phan, Son Truong NguyenIea/aie 2021

TL;DR

This paper introduces a novel hierarchical Transformer model for Vietnamese spelling correction, leveraging both character-level and word-level information to improve accuracy. They also present a new, realistic dataset for Vietnamese spelling correction, aiming to facilitate future research in this under-resourced area.

What Problem Does This Paper Address?

Spelling correction is a crucial feature in many applications, enhancing user experience and productivity. While well-researched for languages like English and Chinese, Vietnamese spelling correction has received limited attention. This leads to a poor user experience for Vietnamese speakers, especially in applications like word processors and messaging platforms. Existing approaches often rely on rule-based methods or lack the sophistication to handle the nuances of Vietnamese spelling, which can be affected by factors like regional dialects and typing styles. The authors aim to bridge this gap by developing a robust machine learning model and a relevant benchmark dataset.

Methods

The core of the proposed solution is a Hierarchical Transformer Encoder model. This architecture processes input text at two levels simultaneously:

  • Character-level Encoder: This component captures fine-grained character information, crucial for detecting errors that might involve subtle misspellings or diacritic issues.
  • Word-level Encoder: This component processes the text at the word level, understanding the broader context and semantic relationships between words.

These two encoders work in tandem within a hierarchical structure. The model utilizes Transformer encoder architectures, similar to those used in state-of-the-art NLP models like BERT, but adapted for this specific task. The outputs from both the character and word-level encoders are combined to generate representations that are then fed into two classifiers:

  • Detection Classifier: Identifies whether a token is likely a spelling error.
  • Correction Classifier: Suggests a suitable replacement for detected errors.

The model is trained using a combined loss function that optimizes both detection and correction accuracy.

Datasets

The paper introduces a new dataset for Vietnamese spelling correction:

  • Wiki Spelling Test Set: This dataset was manually collected from drafts of Vietnamese Wikipedia articles. The authors argue that these drafts, often submitted without extensive spelling revision, provide a realistic representation of common spelling mistakes encountered in real-world texts. This contrasts with artificially generated test sets, which they believe may not accurately reflect practical usage. The dataset contains approximately 1,500 spelling errors across 14,000 sentences.

For training, the authors utilized a combination of:

  • News Texts: Collected from Vietnamese news sources published from 2014 onwards, which are generally well-revised.
  • Vietnamese Wikipedia Articles: Similar to the test set, these provide a source of real-world text.
  • Oral Texts: High-quality transcribed oral texts were also included.

The training data generation process involved a random rule-based generator to introduce various types of spelling errors, ensuring the model learns to handle a diverse range of mistakes.

Key Insights and Ideas

  • Hierarchical Approach is Key: Combining character-level and word-level information is crucial for effectively detecting and correcting Vietnamese spelling errors. Character-level processing helps with subtle errors, while word-level processing captures context.
  • Realistic Data Matters: The authors emphasize the importance of using real-world, uncurated data (like Wikipedia drafts) for building robust spelling correction models, as artificially generated datasets may not generalize well to practical scenarios.
  • Transformer's Adaptability: The Transformer architecture, known for its success in various NLP tasks, proves to be a strong foundation for spelling correction, even when adapted hierarchically.
  • Diacritic Restoration is Important: The paper acknowledges that non-diacritic Vietnamese texts are common and easier to type, but often cause misunderstandings. Offering diacritic restoration is seen as a way to improve the model's functionality.

Key Results

The proposed hierarchical Transformer model achieved state-of-the-art results on the Wiki spelling test set.

  • Detector Performance: The model achieved an F1-score of 68.88% for error detection, outperforming other models and an external tool.
  • Corrector Performance: The model achieved a correction accuracy of 64.29% on total errors, significantly higher than other baselines.
  • Subtitle Diacritic Restoration: On a separate subtitle dataset, the model demonstrated excellent performance in diacritic restoration, with a correction accuracy of 98.17% and a detector F1-score of 99.75%.

The hierarchical Transformer model with both character and word encoders consistently outperformed models that used only word-level encoders or traditional Bi-LSTM approaches.

Limitations and Future Work

  • Token-to-Token Limitation: The current model treats correction as a token-by-token classification problem. This means the output vocabulary for a single token is fixed, which can be a limitation for use-cases involving joined consecutive words (e.g., due to whitespace omission) or abbreviations.
  • Inference Speed: While the model is effective, the authors note that machine translation models, which could potentially handle some of these multi-token issues, are significantly slower and not suitable for real-time applications.
  • Future Work: The authors plan to:
  • Expand the Wikipedia spelling test set and build similar datasets for Vietnamese news and verbal messages.
  • Develop more robust and powerful architectures to offer a more satisfying user experience.

Summary updated

BibTeX
@inproceedings{tran2021hierarchical,
  author = {Hieu Tran and Cuong V. Dinh and Long Phan and Son Truong Nguyen},
  title = {{Hierarchical Transformer Encoders for Vietnamese Spelling Correction}},
  booktitle = {Iea/aie},
  year = {2021},
  doi = {10.1007/978-3-030-79457-6\_46},
}
Figure