getCostByOrderOfPhoneme method

double getCostByOrderOfPhoneme(
  1. int orderIndex
)

Retrieves the weight based on the order of the phoneme in a syllable

The orderIndex indicates the position of the phoneme within the syllable, with 0 being the first phoneme, 1 being the second, and 2 being the third. If the orderIndex is out of range, the default single phoneme cost is returned.

Implementation

double getCostByOrderOfPhoneme(int orderIndex) {
  int phonemeIndex = orderIndex % _koreanCharSyllableNumber;

  if (phonemeIndex == 0) {
    return chosungCost;
  } else if (phonemeIndex == 1) {
    return jungsungCost;
  } else if (phonemeIndex == 2) {
    return jongsungCost;
  } else {
    return _defaultSinglePhonemeCost;
  }
}