Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/khaphanspace/gonhanh.org/llms.txt

Use this file to discover all available pages before exploring further.

Tone Placement

This guide explains how Gõ Nhanh determines where to place tone marks (dấu thanh) and diacritics (dấu phụ) in Vietnamese text.

Overview

Vietnamese is a tonal language with 6 tones, represented by diacritical marks placed on vowels:
ToneMarkExampleName
Level(none)maNgang
Falling`Huyền
Rising´Sắc
Tumbling̉mảHỏi
Rising glottalized~Ngã
Falling glottalizeḍmạNặng
The challenge: Where does the tone mark go when there are multiple vowels? Gõ Nhanh implements the complete Vietnamese orthography rules to automatically place marks on the correct vowel.

Basic Rules

Single Vowel

When the syllable has only one vowel, the tone mark goes on that vowel:
bá, bà, bả, bã, bạ

Multiple Vowels

For syllables with 2-3 vowels, Gõ Nhanh uses the priority system:
1

Priority 1: Vowels with existing diacritics

If a vowel already has a circumflex (^), horn (ơ, ư), or breve (ă), place the tone mark there.Examples:
  • sứa - tone on (has horn)
  • đời - tone on (has horn)
  • luật - tone on (has circumflex)
2

Priority 2: Position in vowel cluster

For vowel pairs without diacritics, use the main vowel (âm chính) according to phonetic rules.Examples:
  • hai - tone on a (first vowel is main)
  • hoa - tone on a (second vowel is main after o medial)
  • nguyễn - tone on (middle vowel of three)

Modern vs. Traditional Tone Placement

Vietnamese has two accepted tone placement styles: Kiểu mới (Modern) and Kiểu cũ (Traditional).

Kiểu mới (Modern) - Default

Based on phonetics and the 2018 Ministry of Education guidelines. Places tone marks according to the main vowel in IPA phonetic transcription. Examples:
  • hoà (not hòa) - /wa/ → tone on a
  • khoẻ (not khỏe) - /wɛ/ → tone on e
  • thuỷ (not thủy) - /wi/ → tone on y

Kiểu cũ (Traditional)

Based on visual aesthetics and pre-1950 dictionaries. Places tone marks near the center of the word for balance. Examples:
  • hòa (not hoà)
  • khỏe (not khoẻ)
  • thủy (not thuỷ)

Changing the Style

In SettingsQuy tắc gõĐặt dấu kiểu mới:
  • Enabled = Modern style (hoà, khoẻ, thuỷ)
  • Disabled = Traditional style (hòa, khỏe, thủy)
Both styles are correct and widely used in Vietnam. Choose based on your preference or organization’s style guide.

Tone Mark Matrix

Gõ Nhanh implements 43 vowel patterns covering all valid Vietnamese combinations.

Two-Vowel Combinations

PatternKeysTone PositionExamples
aiA+Iahái, mài, sải, dãi, mại
aoA+Oacao, sào, hảo, não, tạo
auA+Uasau, mầu, dẩu, mãu, mậu
âuA+A+Uâsâu, lầu, đẩu, trẫu, chậu
âyA+A+Yâđây, tầy, hẩy, mãy, mậy
eoE+Oekẹo, rẻo, méo
êuE+E+Uêkêu, rều, khểu, nghễu, liệu
iaI+Aikía, ghì̀a, bỉa, nghĩa, xía
I+E+Eêtiến, miền, kiểu, biễn, điệp
iuI+Uidịu, kìu, tỉu
oaO+Aahoa, toà, hoả, khoã, khoạ
oeO+Eekhoẻ, oé, toẹ
oiO+Iotới, nòi, đổi, mõi, cọi
ôiO+O+Iôtôi, hồi, tổi, mỗi, khối
ơiO+W+Iơbơi, nời, rởi, mỡi, nợi
uaU+Au (open)mua, cùa, sủa, mũa, múa
uaQ+U+Aa (after q)qua, quà, quả, quã, quạ
U+E+Eêhuế, muền, tuể
uiU+Iuvui, nùi, thủi, nhũi, múi
U+O+Oôthuốc, nguồn, quổng
uyU+Yyquy, duyên, chuyển, hủy, thúy
ưaU+W+Aưmưa, chừa, tửa, mữa, lựa
ươU+W+Oơmười, người, lướn, khuỡng, lượm
ưuU+W+Uư (first)lưu, hừu, dửu, mữu, kịu

Three-Vowel Combinations

PatternKeysTone PositionExamples
iêuI+E+E+Uêtiêu, miều, diễu, liệu
yêuY+E+E+Uêyêu, nguyễn
oaiO+A+Iangoài, loại, hoài, khoãi, ngoại
oayO+A+Yaxoáy, khoảy, ngoãy
oeoO+E+Oekhoèo, ngoéo, khỏeo
uâyU+A+A+Yâkhuấy, quầy, quẩy
uôiU+O+O+Iôcuối, tuổi, nguồi, buổi
ươiU+W+O+Iơmười, tươi, lười, khuỡi, cười
ươuU+W+O+Uơrượu, hương, nước, cườm
uyêU+Y+E+Eêchuyến, nguyện, tuyển

Invalid Combinations

These vowel combinations do not exist in Vietnamese and will not receive diacritics:
  • ou, eu, ae, yi, wu
  • ôa, âi, ôe (must use plain vowels)
  • eng, êng (use -nh instead: anh, ênh)

Diacritic Placement (Dấu phụ)

Before placing tone marks, Gõ Nhanh first applies diacritics (circumflex, horn, breve).

Telex Method

InputDiacriticResult
aaCircumflexâ
eeCircumflexê
ooCircumflexô
awBreveă
owHornơ
uwHornư

Special Cases

Input: uow or uwoBoth u and o receive the horn:
u + o + w → ươ
Examples: được, mười, người

Final Consonant Rules

The final consonant (phụ âm cuối) affects tone placement:

Open Syllables (No Final Consonant)

Tone mark placement follows the standard vowel priority rules.

Closed Syllables (With Final Consonant)

When a syllable ends with a consonant, tone placement depends on whether the final is sonorant: Sonorant finals (-m, -n, -ng, -nh):
  • Follow standard vowel priority
  • All tones allowed
Obstruent finals (-p, -t, -c, -ch):
  • Only sắc (rising) and nặng (falling glottalized) tones allowed
  • Examples: cấp, mật, các, ách
  • Invalid: cảp, mãt, càc, ạch
This is a phonotactic constraint - syllables ending in -p, -t, -c, -ch cannot have huyền, hỏi, or ngã tones in Vietnamese.

Implementation Details

Gõ Nhanh implements tone placement in the core Rust engine:

Vowel Collection

// ~/workspace/source/core/src/engine/transform.rs:174-185
pub fn apply_mark(buf: &mut Buffer, mark_value: u8, modern: bool) -> TransformResult {
    let vowels = utils::collect_vowels(buf);
    if vowels.is_empty() {
        return TransformResult::none();
    }

    // Find position using phonology rules
    let last_vowel_pos = vowels.last().map(|v| v.pos).unwrap_or(0);
    let has_final = utils::has_final_consonant(buf, last_vowel_pos);
    let has_qu = utils::has_qu_initial(buf);
    let has_gi = utils::has_gi_initial(buf);
    let pos = Phonology::find_tone_position(&vowels, has_final, modern, has_qu, has_gi);

Context-Aware Placement

The find_tone_position function considers:
  1. Number of vowels (1, 2, or 3)
  2. Diacritics present (circumflex, horn, breve)
  3. Final consonant (yes/no)
  4. Tone style (modern/traditional)
  5. Special initials (qu, gi)
Reference: ~/workspace/source/core/src/data/vowel.rs (Phonology module)

Vietnamese Orthography Resources

For a complete reference of Vietnamese phonology and orthography:
  • Vowel System: See ~/workspace/source/docs/vietnamese-language-system.md Section 3
  • Tone Placement Matrix: Section 7.6 (43 patterns)
  • Validation Rules: ~/workspace/source/docs/validation-algorithm.md

Quick Reference

Vietnamese has:
  • 12 base vowels: a, ă, â, e, ê, i, o, ô, ơ, u, ư, y
  • 29 diphthongs: ai, ao, au, ây, âu, eo, êu, ia, iê, iu, oa, oă, oe, oi, ôi, ơi, ua, uâ, uê, ui, uô, uy, ưa, ưi, ươ, ưu, yê
  • 14 triphthongs: iêu, yêu, oai, oay, oeo, uây, uôi, uya, ươi, ươu, uyê, uyu, uêu, oao
  • 6 tones: ngang, huyền, sắc, hỏi, ngã, nặng

Testing Tone Placement

You can verify tone placement by typing test words:

Test Cases

Input (Telex)Expected OutputTests
hoafhoà (modern) or hòa (traditional)oa+tone placement
khoẻkhoẻ (modern) or khỏe (traditional)oe+tone placement
nguyeenxnguyễnTriphthong uyê
duowcjđượcươ with tone
luuujlưuưu with tone
tieeustiếuiêu with tone
quatssquấtua after q + nặng

Invalid Combinations

These should not transform:
Input (Telex)ResultReason
taafootàooV1 has tone → no circumflex on V2
tifaatìaaV1 has tone → no circumflex on V2
ceceInvalid consonant+vowel (use ke)

Build docs developers (and LLMs) love