This template receives a "de-composed" vietnamese non-compound word and gives the IPA code for it.

Cách sử dụng sửa

Usage: {{VieIPA|c1|c2|c3|...}}, where cn is the character number n in the word, give the IPA if the word is a valid Vietnamese word and strange result otherwise.

This template does not sandwich the IPA code between "/" and "/"; this makes the template more robust (usable for compound word, for example).

Ví dụ sửa

The code

Thích Nhất Hạnh /{{IPA|{{VieIPA|T|h|í|c|h}} {{VieIPA|N|h|ấ|t}} {{VieIPA|H|ạ|n|h}}}}/

gives:

Thích Nhất Hạnh /tʰik35 ɲɜt35 hɐ̰ːʲŋ31/

Nó hoạt động làm sao? sửa

This template will break a Vietnamese word into 3 parts plus the tonal part: (C1) + [ (w) + V + (G) ] + (C2) + T, according to this article.

Then the IPA code is returned for C1 by Template:VieC1, for [(w) + V + (G)] by Template:VieWVG, for C2 by Template:VieC2 and for T by Template:VieTn.

This template also uses Template:VieV and Template:VieC to detect Vietnamese consonants and vowels, inside its logical flow.

The logical flow is follow:

  1. If the 1st character is a vowel, there is no C1, and the (w)+V+(G) part is selected from 3 first characters, C2 part is selected from 4 last characters, T part is found from 3 first characters.
  2. Otherwise there is a C1 (we assume the 1st character is a consonant for valid Vietnamese word).
    1. If the 1st character is g (or G)
      1. If the 2nd character is i (or ì, í, ỉ, ị, ĩ)
        1. If there is a 3rd character then C1 is /z/ and (w)+V+(G) + (C2) + T found from the 3rd character onward (we assume here that the second character is actually "i" for valid Vietnamese word).
        2. If there is no 3rd character then we have C1 /z/ and (w)+V+(G) + T found from the 2nd character.
      2. If the 2nd character is h then C1 is /ɣ/ and (w)+V+(G) + (C2) + T is found from the 3rd character onward.
      3. otherwise C1 is /ɣ/ and (w)+V+(G) + (C2) + T is found from the 2nd character onward (we assume 2nd character is a vowel for valid Vietnamese word).
    2. If the 1st character is q (or Q) then C1 is /kw/ and (w)+V+(G) + (C2) + T is found from the 3rd character onward (we assume 2nd character is "u" for valid Vietnamese word).
    3. Otherwise
      1. If 2nd character is a consonant
        1. If 3rd character is a consonant then C1 is /ŋ/ and (w)+V+(G) + (C2) + T is found from the 4th character onward (we assume the 3 first characters are "ngh" the only Vietnamese valid case for this).
        2. Otherwise C1 is found from 2 first characters and (w)+V+(G) + (C2) + T is found from the 3rd character onward (we assume the 3rd character is a vowel for valid Vietnamese word).
      2. Otherwise C1 is found from 1st character and (w)+V+(G) + (C2) + T is found from the 2nd character onward (we assume the 2nd character is a vowel for valid Vietnamese word).

Xem thêm sửa