fi: fix behaviour of S_2_TO_HEAVY (adding secondary stress)

Stress flag S_2_TO_HEAVY is currently only used by finnish.

Current behaviour skips adding secondary stress if the following syllable is heavy. The behaviour should be to skip adding secondary stress if the rest of the word (excluding last syllable) contains a heavy syllable.

Source of grammar rule and examples of expected behaviour: http://scripta.kotus.fi/visk/sisallys.php?p=13
This commit is contained in:
Juho Hiltunen
2018-01-14 14:48:36 +02:00
parent 3a8e234fa3
commit afb4fe75e2
+13
View File
@@ -1373,6 +1373,19 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
if ((stress == 3) && (stressflags & S_NO_AUTO_2))
continue; // don't use secondary stress
// don't put secondary stress on a light syllable if the rest of the word (excluding last syllable) contains a heavy syllable
if ((v > 1) && (stressflags & S_2_TO_HEAVY) && (syllable_weight[v] == 0)) {
bool skip = false;
for (int i = v; i < vowel_count - 1; i++) {
if (syllable_weight[i] > 0) {
skip = true;
break;
}
}
if (skip == true)
continue;
}
if ((v > 1) && (stressflags & S_2_TO_HEAVY) && (syllable_weight[v] == 0) && (syllable_weight[v+1] > 0)) {
// don't put secondary stress on a light syllable which is followed by a heavy syllable
continue;