Browse Source

phoneme_add_feature: recognise diacritic features.

master
Reece H. Dunn 8 years ago
parent
commit
b47600d951
2 changed files with 105 additions and 3 deletions
  1. 3
    3
      src/libespeak-ng/compiledata.c
  2. 102
    0
      src/libespeak-ng/phoneme.c

+ 3
- 3
src/libespeak-ng/compiledata.c View File

@@ -291,12 +291,12 @@ static keywtab_t keywords[] = {
{ "sibilant", tPHONEME_FLAG, phSIBILANT }, // TODO (deprecated): use 'sib' instead
{ "nolink", tPHONEME_FLAG, phNOLINK },
{ "trill", tPHONEME_FLAG, phTRILL }, // TODO (deprecated): use 'trl' instead
{ "palatal", tPHONEME_FLAG, phPALATAL },
{ "palatal", tPHONEME_FLAG, phPALATAL }, // TODO (deprecated): use 'pzd' instead
{ "long", tPHONEME_FLAG, phLONG },
{ "dontlist", tPHONEME_FLAG, phDONTLIST },
{ "brkafter", tPHONEME_FLAG, phBRKAFTER },
{ "rhotic", tPHONEME_FLAG, phRHOTIC },
{ "nonsyllabic", tPHONEME_FLAG, phNONSYLLABIC },
{ "rhotic", tPHONEME_FLAG, phRHOTIC }, // TODO (deprecated): use 'rzd' instead
{ "nonsyllabic", tPHONEME_FLAG, phNONSYLLABIC }, // TODO (deprecated): use 'nsy' instead
{ "lengthenstop", tPHONEME_FLAG, phLENGTHENSTOP },
{ "nopause", tPHONEME_FLAG, phNOPAUSE },
{ "prevoice", tPHONEME_FLAG, phPREVOICE },

+ 102
- 0
src/libespeak-ng/phoneme.c View File

@@ -80,6 +80,45 @@ enum feature_t {
// rounding
unr = FEATURE('u', 'n', 'r'),
rnd = FEATURE('r', 'n', 'd'),
// articulation
lgl = FEATURE('l', 'g', 'l'),
idt = FEATURE('i', 'd', 't'),
apc = FEATURE('a', 'p', 'c'),
lmn = FEATURE('l', 'm', 'n'),
// air flow
egs = FEATURE('e', 'g', 's'),
igs = FEATURE('i', 'g', 's'),
// phonation
brv = FEATURE('b', 'r', 'v'),
slv = FEATURE('s', 'l', 'v'),
stv = FEATURE('s', 't', 'v'),
crv = FEATURE('c', 'r', 'v'),
glc = FEATURE('g', 'l', 'c'),
// rounding and labialization
ptr = FEATURE('p', 't', 'r'),
cmp = FEATURE('c', 'm', 'p'),
mrd = FEATURE('m', 'r', 'd'),
lrd = FEATURE('l', 'r', 'd'),
// syllabicity
syl = FEATURE('s', 'y', 'l'),
nsy = FEATURE('n', 's', 'y'),
// consonant release
asp = FEATURE('a', 's', 'p'),
nrs = FEATURE('n', 'r', 's'),
lrs = FEATURE('l', 'r', 's'),
unx = FEATURE('u', 'n', 'x'),
// coarticulation
pzd = FEATURE('p', 'z', 'd'),
vzd = FEATURE('v', 'z', 'd'),
fzd = FEATURE('f', 'z', 'd'),
nzd = FEATURE('n', 'z', 'd'),
rzd = FEATURE('r', 'z', 'd'),
// tongue root
atr = FEATURE('a', 't', 'r'),
rtr = FEATURE('r', 't', 'r'),
// fortis and lenis
fts = FEATURE('f', 't', 's'),
lns = FEATURE('l', 'n', 's'),
};

uint32_t lookup_feature(const char *feature) {
@@ -210,6 +249,69 @@ phoneme_add_feature(PHONEME_TAB *phoneme,
case rnd:
// Not supported by eSpeak.
break;
// articulation
case lgl:
case idt:
case apc:
case lmn:
// Not supported by eSpeak.
break;
// air flow
case egs:
case igs:
// Not supported by eSpeak.
break;
// phonation
case brv:
case slv:
case stv:
case crv:
case glc:
// Not supported by eSpeak.
break;
// rounding and labialization
case ptr:
case cmp:
case mrd:
case lrd:
// Not supported by eSpeak.
break;
// syllabicity
case syl:
// Not supported by eSpeak.
break;
case nsy:
phoneme->phflags |= phNONSYLLABIC;
break;
// consonant release
case asp:
case nrs:
case lrs:
case unx:
// Not supported by eSpeak.
break;
// coarticulation
case pzd:
phoneme->phflags |= phPALATAL;
break;
case vzd:
case fzd:
case nzd:
// Not supported by eSpeak.
break;
case rzd:
phoneme->phflags |= phRHOTIC;
break;
// tongue root
case atr:
case rtr:
// Not supported by eSpeak.
break;
// fortis and lenis
case fts:
case lns:
// Not supported by eSpeak.
break;
// invalid phoneme feature
default:
return create_name_error_context(context, ENS_UNKNOWN_PHONEME_FEATURE, feature);

Loading…
Cancel
Save