Enum Phonetic

java.lang.Object
java.lang.Enum<Phonetic>
com.lokalized.Phonetic
All Implemented Interfaces:
LanguageForm, Serializable, Comparable<Phonetic>, Constable

public enum Phonetic extends Enum<Phonetic> implements LanguageForm
Represents the phonetic onset category of a word, used to select context-appropriate word forms in localized strings.

Many languages require different word forms based on the sound that follows. For example, English uses "a" before consonant sounds and "an" before vowel sounds. Italian has more complex rules requiring different articles before vowels, s+consonant clusters, and certain other onsets.

The phonetic category of a word is determined at runtime by a user-supplied resolver function, since correct classification often requires language-specific knowledge and exception handling.

Since:
1.2.0
Author:
Mark Allen
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Word begins with a typical consonant sound.
    Word begins with W functioning as a consonantal glide /w/.
    Word begins with Y functioning as a consonantal glide /j/.
    Word begins with the palatal nasal cluster GN.
    Word begins with an aspirated (pronounced) H.
    Word begins with a silent H, making it phonetically vowel-initial.
    Arabic moon letter (الحروف القمرية).
    Fallback category for edge cases not covered by other values.
    Word begins with the PN cluster.
    Word begins with the PS cluster.
    Word begins with s + consonant cluster (s impura).
    Arabic sun letter (الحروف الشمسية).
    Word begins with a stressed A or HA sound.
    Word begins with a vowel sound.
    Word begins with X (/ks/ sound).
    Word begins with Z sound or affricates /ts/, /dz/.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Phonetic
    Returns the enum constant of this type with the specified name.
    static Phonetic[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • VOWEL

      public static final Phonetic VOWEL
      Word begins with a vowel sound.

      Applies to most languages. In English, triggers "an" instead of "a". In French, triggers elision (le/la → l'). In Italian, triggers l' for singular articles.

      Note: Classification is by sound, not spelling. English "hour" is phonetically vowel-initial; "university" is not.

    • CONSONANT

      public static final Phonetic CONSONANT
      Word begins with a typical consonant sound.

      This is the default category for words not matching any other phonetic pattern. In English, triggers "a" instead of "an". In Italian, triggers "il" for masculine singular nouns.

    • H_SILENT

      public static final Phonetic H_SILENT
      Word begins with a silent H, making it phonetically vowel-initial.

      Primarily applies to English and French.

      English examples: "hour", "honor", "heir" → "an hour"

      French examples (h muet): "homme", "heure" → "l'homme"

    • H_ASPIRATED

      public static final Phonetic H_ASPIRATED
      Word begins with an aspirated (pronounced) H.

      Primarily applies to English and French.

      English examples: "house", "happy" → "a house"

      French examples (h aspiré): "héros", "haricot" → "le héros" (no elision)

    • S_IMPURE

      public static final Phonetic S_IMPURE
      Word begins with s + consonant cluster (s impura).

      Primarily applies to Italian. Triggers "lo/gli" instead of "il/i" for masculine nouns, and "uno" instead of "un".

      Examples: "studente", "spaghetti", "sbaglio", "scuola" → "lo studente", "gli spaghetti"

    • Z

      public static final Phonetic Z
      Word begins with Z sound or affricates /ts/, /dz/.

      Primarily applies to Italian. Triggers "lo/gli" instead of "il/i" for masculine nouns.

      Examples: "zio", "zero", "zucchero" → "lo zio", "gli zii"

    • GN

      public static final Phonetic GN
      Word begins with the palatal nasal cluster GN.

      Primarily applies to Italian. Triggers "lo/gli" instead of "il/i" for masculine nouns.

      Examples: "gnomo", "gnocco" → "lo gnomo", "gli gnocchi"

    • PS

      public static final Phonetic PS
      Word begins with the PS cluster.

      Primarily applies to Italian, typically in words of Greek origin. Triggers "lo/gli" instead of "il/i".

      Examples: "psicologo", "pseudonimo" → "lo psicologo"

    • PN

      public static final Phonetic PN
      Word begins with the PN cluster.

      Primarily applies to Italian, typically in words of Greek origin. Triggers "lo/gli" instead of "il/i".

      Examples: "pneumatico", "pneumologo" → "lo pneumatico"

    • X

      public static final Phonetic X
      Word begins with X (/ks/ sound).

      Primarily applies to Italian. Triggers "lo/gli" instead of "il/i". Rare in Italian vocabulary.

      Examples: "xilofono", "xenofobo" → "lo xilofono"

    • GLIDE_Y

      public static final Phonetic GLIDE_Y
      Word begins with Y functioning as a consonantal glide /j/.

      Primarily applies to Italian, where loanwords starting with Y take "lo/gli" instead of "il/i".

      Examples: "yogurt", "yacht" → "lo yogurt"

      Note: In English, Y is typically treated as CONSONANT.

    • GLIDE_W

      public static final Phonetic GLIDE_W
      Word begins with W functioning as a consonantal glide /w/.

      May apply to Italian and other languages where W-initial words (typically loanwords) require special handling.

      Examples: "whisky", "weekend"

    • STRESSED_A

      public static final Phonetic STRESSED_A
      Word begins with a stressed A or HA sound.

      Primarily applies to Spanish and Catalan. Feminine nouns with stressed initial A take masculine singular articles for euphonic reasons, while remaining grammatically feminine.

      Examples: "agua", "águila", "hacha", "alma" → "el agua" (not "la agua"), but "las aguas" in plural

      Note: The noun remains feminine—adjectives still agree femininely: "el agua fría" (the cold water).

    • SOLAR

      public static final Phonetic SOLAR
      Arabic sun letter (الحروف الشمسية).

      Applies to Arabic. When the definite article "al-" precedes a sun letter, the L assimilates to the following consonant.

      Sun letters: ت ث د ذ ر ز س ش ص ض ط ظ ل ن

      Example: "al-shams" is pronounced "ash-shams" (the sun)

    • LUNAR

      public static final Phonetic LUNAR
      Arabic moon letter (الحروف القمرية).

      Applies to Arabic. When the definite article "al-" precedes a moon letter, the L is pronounced normally without assimilation.

      Moon letters: ب ج ح خ ع غ ف ق ك م هـ و ي ء

      Example: "al-qamar" is pronounced as written (the moon)

    • OTHER

      public static final Phonetic OTHER
      Fallback category for edge cases not covered by other values.

      Use this when a word doesn't fit cleanly into any other phonetic category, allowing graceful degradation in localized string selection.

  • Method Details

    • values

      public static Phonetic[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Phonetic valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null