mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-20 19:21:57 +00:00
Better document the other condition checks (isDiminished, etc.).
This commit is contained in:
@@ -120,22 +120,22 @@ static keywtab_t k_properties[] = {
|
||||
|
||||
{ "isVel", 0, CONDITION_IS_PLACE_OF_ARTICULATION | phPLACE_VELAR },
|
||||
|
||||
{ "isDiminished", 0, i_isDiminished },
|
||||
{ "isUnstressed", 0, i_isUnstressed },
|
||||
{ "isNotStressed", 0, i_isNotStressed },
|
||||
{ "isStressed", 0, i_isStressed },
|
||||
{ "isMaxStress", 0, i_isMaxStress },
|
||||
{ "isDiminished", 0, CONDITION_IS_OTHER | isDiminished },
|
||||
{ "isUnstressed", 0, CONDITION_IS_OTHER | isUnstressed },
|
||||
{ "isNotStressed", 0, CONDITION_IS_OTHER | isNotStressed },
|
||||
{ "isStressed", 0, CONDITION_IS_OTHER | isStressed },
|
||||
{ "isMaxStress", 0, CONDITION_IS_OTHER | isMaxStress },
|
||||
|
||||
{ "isPause2", 0, i_isBreak },
|
||||
{ "isWordStart", 0, i_isWordStart },
|
||||
{ "isWordEnd", 0, i_isWordEnd },
|
||||
{ "isAfterStress", 0, i_isAfterStress },
|
||||
{ "isNotVowel", 0, i_isNotVowel },
|
||||
{ "isFinalVowel", 0, i_isFinalVowel },
|
||||
{ "isVoiced", 0, i_isVoiced }, // voiced consonant, or vowel
|
||||
{ "isFirstVowel", 0, i_isFirstVowel },
|
||||
{ "isSecondVowel", 0, i_isSecondVowel },
|
||||
{ "isTranslationGiven", 0, i_IsTranslationGiven }, // phoneme translation given in **_list or as [[...]]
|
||||
{ "isPause2", 0, CONDITION_IS_OTHER | isBreak },
|
||||
{ "isWordStart", 0, CONDITION_IS_OTHER | isWordStart },
|
||||
{ "isWordEnd", 0, CONDITION_IS_OTHER | isWordEnd },
|
||||
{ "isAfterStress", 0, CONDITION_IS_OTHER | isAfterStress },
|
||||
{ "isNotVowel", 0, CONDITION_IS_OTHER | isNotVowel },
|
||||
{ "isFinalVowel", 0, CONDITION_IS_OTHER | isFinalVowel },
|
||||
{ "isVoiced", 0, CONDITION_IS_OTHER | isVoiced },
|
||||
{ "isFirstVowel", 0, CONDITION_IS_OTHER | isFirstVowel },
|
||||
{ "isSecondVowel", 0, CONDITION_IS_OTHER | isSecondVowel },
|
||||
{ "isTranslationGiven", 0, CONDITION_IS_OTHER | isTranslationGiven },
|
||||
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -636,22 +636,22 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
return ((ph->phflags >> 16) & 0xf) == data;
|
||||
case CONDITION_IS_PHFLAG_SET:
|
||||
return (ph->phflags & (1 << data)) != 0;
|
||||
case 0x80:
|
||||
case CONDITION_IS_OTHER:
|
||||
switch (data)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case isDiminished:
|
||||
case isUnstressed:
|
||||
case isNotStressed:
|
||||
case isStressed:
|
||||
case isMaxStress:
|
||||
return StressCondition(tr, plist, data, 0);
|
||||
case 5: // isBreak, Either pause phoneme, or (stop/vstop/vfric not followed by vowel or (liquid in same word))
|
||||
case isBreak:
|
||||
return (ph->type == phPAUSE) || (plist_this->synthflags & SFLAG_NEXT_PAUSE);
|
||||
case 6: // isWordStart
|
||||
case isWordStart:
|
||||
return plist->sourceix != 0;
|
||||
case 8: // isWordEnd
|
||||
case isWordEnd:
|
||||
return plist[1].sourceix || (plist[1].ph->type == phPAUSE);
|
||||
case 9: // isAfterStress
|
||||
case isAfterStress:
|
||||
if (plist->sourceix != 0)
|
||||
return false;
|
||||
do {
|
||||
@@ -661,9 +661,9 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
|
||||
} while (plist->sourceix == 0);
|
||||
break;
|
||||
case 10: // isNotVowel
|
||||
case isNotVowel:
|
||||
return ph->type != phVOWEL;
|
||||
case 11: // isFinalVowel
|
||||
case isFinalVowel:
|
||||
for (;;) {
|
||||
plist++;
|
||||
if (plist->sourceix != 0)
|
||||
@@ -671,13 +671,13 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
if (plist->ph->type == phVOWEL)
|
||||
return false;
|
||||
}
|
||||
case 12: // isVoiced
|
||||
case isVoiced:
|
||||
return (ph->type == phVOWEL) || (ph->type == phLIQUID) || (ph->phflags & phVOICED);
|
||||
case 13: // isFirstVowel
|
||||
case isFirstVowel:
|
||||
return CountVowelPosition(plist) == 1;
|
||||
case 14: // isSecondVowel
|
||||
case isSecondVowel:
|
||||
return CountVowelPosition(plist) == 2;
|
||||
case 0x10: // isTranslationGiven
|
||||
case isTranslationGiven:
|
||||
return (plist->synthflags & SFLAG_DICTIONARY) != 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -312,26 +312,27 @@ typedef struct {
|
||||
#define i_WAVADD 0xf000
|
||||
|
||||
// conditions
|
||||
#define i_isDiminished 0x80
|
||||
#define i_isUnstressed 0x81
|
||||
#define i_isNotStressed 0x82
|
||||
#define i_isStressed 0x83
|
||||
#define i_isMaxStress 0x84
|
||||
|
||||
#define i_isBreak 0x85
|
||||
#define i_isWordStart 0x86
|
||||
#define i_isWordEnd 0x88
|
||||
#define i_isAfterStress 0x89
|
||||
#define i_isNotVowel 0x8a
|
||||
#define i_isFinalVowel 0x8b
|
||||
#define i_isVoiced 0x8c
|
||||
#define i_isFirstVowel 0x8d
|
||||
#define i_isSecondVowel 0x8e
|
||||
#define i_IsTranslationGiven 0x90
|
||||
|
||||
#define CONDITION_IS_PHONEME_TYPE 0x00
|
||||
#define CONDITION_IS_PLACE_OF_ARTICULATION 0x20
|
||||
#define CONDITION_IS_PHFLAG_SET 0x40
|
||||
#define CONDITION_IS_OTHER 0x80
|
||||
|
||||
// other conditions
|
||||
#define isDiminished 0
|
||||
#define isUnstressed 1
|
||||
#define isNotStressed 2
|
||||
#define isStressed 3
|
||||
#define isMaxStress 4
|
||||
#define isBreak 5 // pause phoneme or (stop/vstop/vfric not followed by vowel or (liquid in same word))
|
||||
#define isWordStart 6
|
||||
#define isWordEnd 8
|
||||
#define isAfterStress 9
|
||||
#define isNotVowel 10
|
||||
#define isFinalVowel 11
|
||||
#define isVoiced 12 // voiced consonant, or vowel
|
||||
#define isFirstVowel 13
|
||||
#define isSecondVowel 14
|
||||
#define isTranslationGiven 16 // phoneme translation given in **_list or as [[...]]
|
||||
|
||||
#define i_StressLevel 0x800
|
||||
|
||||
|
||||
Reference in New Issue
Block a user