Browse Source

Issue espeak-ng/espeak-ng#120

Allow to decrease the score in the rule by adding
master
Valdis Vitolins 8 years ago
parent
commit
252c894e59

+ 2
- 1
docs/dictionary.md View File

| Symbol | Description | | Symbol | Description |
|-------------|-------------| |-------------|-------------|
| `@` | A vowel follows somewhere in the word. | | `@` | A vowel follows somewhere in the word. |
| `+` | Force an increase in the score in this rule (may be repeated for more effect). |
| `+` | Force an increase in the score in this rule by 20 points (may be repeated for more effect). |
| `<` | Force an decrease in the score in this rule by 20 points (may be repeated for more effect). |
| `S<number>` | This number of matching characters are a standard suffix, remove them and retranslate the word. | | `S<number>` | This number of matching characters are a standard suffix, remove them and retranslate the word. |
| `P<number>` | This number of matching characters are a standard prefix, remove them and retranslate the word. | | `P<number>` | This number of matching characters are a standard prefix, remove them and retranslate the word. |
| `Lnn` | `nn` is a 2-digit decimal number in the range 01 to 20 Matches with any of the letter sequences which have been defined for letter group `nn` | | `Lnn` | `nn` is a 2-digit decimal number in the range 01 to 20 Matches with any of the letter sequences which have been defined for letter group `nn` |

+ 4
- 1
src/libespeak-ng/compiledict.c View File

case '+': case '+':
c = RULE_INC_SCORE; c = RULE_INC_SCORE;
break; break;
case '<': // Can't use - as opposite for + because it is used literally as part of word
c = RULE_DEC_SCORE;
break;
case '@': case '@':
c = RULE_SYLLABLE; c = RULE_SYLLABLE;
break; break;
state = 3; state = 3;
p = buf; p = buf;
if (input[ix+1] == ' ') { if (input[ix+1] == ' ') {
fprintf(f_log, "%5d: Syntax error. Space after (\n", linenum);
fprintf(f_log, "%5d: Syntax error. Space after (, or negative score for previous rule\n", linenum);
error_count++; error_count++;
} }
break; break;

+ 3
- 0
src/libespeak-ng/dictionary.c View File

case RULE_INC_SCORE: case RULE_INC_SCORE:
add_points = 20; // force an increase in points add_points = 20; // force an increase in points
break; break;
case RULE_DEC_SCORE:
add_points = -20; // force an decrease in points
break; // TODO schould check why '<' is shown as '!' in rules trace
case RULE_DEL_FWD: case RULE_DEL_FWD:
// find the next 'e' in the word and replace by 'E' // find the next 'e' in the word and replace by 'E'
for (p = *word + group_length; p < post_ptr; p++) { for (p = *word + group_length; p < post_ptr; p++) {

+ 1
- 0
src/libespeak-ng/translate.h View File

#define RULE_NOVOWELS 29 // X no vowels up to word boundary #define RULE_NOVOWELS 29 // X no vowels up to word boundary
#define RULE_SPELLING 31 // W while spelling letter-by-letter #define RULE_SPELLING 31 // W while spelling letter-by-letter
#define RULE_LAST_RULE 31 #define RULE_LAST_RULE 31
#define RULE_DEC_SCORE 33 // <


#define DOLLAR_UNPR 0x01 #define DOLLAR_UNPR 0x01
#define DOLLAR_NOPREFIX 0x02 #define DOLLAR_NOPREFIX 0x02

Loading…
Cancel
Save