puter icon indicating copy to clipboard operation
puter copied to clipboard

Feedback on Turkish Pluralization - Solution with Vowel Harmony

Open hasanbeder opened this issue 1 year ago • 2 comments

Dear Puter Developers, I am writing to provide feedback on the Turkish language support in Puter, specifically regarding the issue of pluralization. Currently, the static "plural_suffix" value does not account for the complexities of Turkish grammar, particularly vowel harmony, leading to inaccuracies.

Proposed Solution: Vowel Harmony-Based Pluralization

Turkish has a vowel harmony system where the vowels within a word must be compatible. This harmony affects the suffixes added to words, including the plural suffix.

1. Identifying Vowel Harmony:

  • The solution involves analyzing the last vowel of a word's stem.
  • If the vowel is a back vowel (a, ı, o, u), the plural suffix "-lar" is used.
  • If the vowel is a front vowel (e, i, ö, ü), the plural suffix "-ler" is used.

2. Handling Exceptions:

  • Some words have irregular plural forms or do not follow vowel harmony rules. A list of these exceptions will be created, and the function will apply the appropriate plural form for these words.

3. Implementation:

  • This solution can be implemented as a function within the language file.
  • The function would take a word as input and return the word with the correct plural suffix based on vowel harmony and exceptions.

Example Code (JavaScript):

function pluralize(word) {
  const lastVowel = word.slice(-1);
  const backVowels = ["a", "ı", "o", "u"];
  const exceptions = {
    diş: "dişler",
    insan: "insan"
    // ... other exceptions
  };

  if (exceptions[word]) {
    return exceptions[word];
  }

  if (backVowels.includes(lastVowel)) {
    return word + "lar";
  } else {
    return word + "ler";
  }
}

I believe that implementing a vowel harmony-based pluralization system will greatly enhance the quality of Puter's Turkish language support.

Sincerely.

hasanbeder avatar Apr 14 '24 10:04 hasanbeder

Every language has its own different way of handling plurals, with its own exceptions. I would personally suggest we try something similar to Android's quantity strings. Then, the translator just writes the different cases themselves, and the software doesn't need to know anything about grammar.

AtkinsSJ avatar Apr 14 '24 18:04 AtkinsSJ

+1 on a pluralize function, but exceptions should be in the language's data file rather than the function itself. I think each language having it's own (optional) pluralize function as a fallback for manual entries is a pretty neat idea. This is effectively a hybrid of the two options that were proposed here.

KernelDeimos avatar Apr 16 '24 06:04 KernelDeimos