Allow to decrease the score in the rule by addingmaster
@@ -206,7 +206,8 @@ syllable counting. | |||
| Symbol | Description | | |||
|-------------|-------------| | |||
| `@` | 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. | | |||
| `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` | |
@@ -854,6 +854,9 @@ static void copy_rule_string(char *string, int *state_out) | |||
case '+': | |||
c = RULE_INC_SCORE; | |||
break; | |||
case '<': // Can't use - as opposite for + because it is used literally as part of word | |||
c = RULE_DEC_SCORE; | |||
break; | |||
case '@': | |||
c = RULE_SYLLABLE; | |||
break; | |||
@@ -1035,7 +1038,7 @@ static char *compile_rule(char *input) | |||
state = 3; | |||
p = buf; | |||
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++; | |||
} | |||
break; |
@@ -1853,6 +1853,9 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_ | |||
case RULE_INC_SCORE: | |||
add_points = 20; // force an increase in points | |||
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: | |||
// find the next 'e' in the word and replace by 'E' | |||
for (p = *word + group_length; p < post_ptr; p++) { |
@@ -182,6 +182,7 @@ extern "C" | |||
#define RULE_NOVOWELS 29 // X no vowels up to word boundary | |||
#define RULE_SPELLING 31 // W while spelling letter-by-letter | |||
#define RULE_LAST_RULE 31 | |||
#define RULE_DEC_SCORE 33 // < | |||
#define DOLLAR_UNPR 0x01 | |||
#define DOLLAR_NOPREFIX 0x02 |