Browse Source

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
master
Juho Hiltunen 7 years ago
parent
commit
afb4fe75e2
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      src/libespeak-ng/dictionary.c

+ 13
- 0
src/libespeak-ng/dictionary.c 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;

Loading…
Cancel
Save