Browse Source

Updates for issue #103 Maximum group number which works is actually 62

master
Valdis Vitolins 8 years ago
parent
commit
92eae4f322
2 changed files with 7 additions and 5 deletions
  1. 2
    0
      src/libespeak-ng/compiledict.c
  2. 5
    5
      src/libespeak-ng/dictionary.c

+ 2
- 0
src/libespeak-ng/compiledict.c View File

@@ -321,6 +321,8 @@ char *DecodeRule(const char *group_chars, int group_length, char *rule, int cont
c = symbols_lg[*rule++ - 'A'];
else if (rb == RULE_LETTERGP2) {
value = *rule++ - 'A';
if (value < 0)
value += 256;
p[0] = 'L';
p[1] = (value / 10) + '0';
c = (value % 10) + '0';

+ 5
- 5
src/libespeak-ng/dictionary.c View File

@@ -164,7 +164,7 @@ static void InitGroups(Translator *tr)

if (p[0] == RULE_LETTERGP2) {
ix = p[1] - 'A';
if (ix < 0) // Issue #103, if gets negative, fix it
if (ix < 0)
ix += 256;
p += 2;
if ((ix >= 0) && (ix < N_LETTER_GROUPS))
@@ -1708,8 +1708,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
{
case RULE_LETTERGP:
letter_group = *rule++ - 'A';
if (letter_group < 0) // Issue #103, if gets negative, fix it
letter_group += 256;
if (IsLetter(tr, letter_w, letter_group)) {
lg_pts = 20;
if (letter_group == 2)
@@ -1721,7 +1719,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
break;
case RULE_LETTERGP2: // match against a list of utf-8 strings
letter_group = *rule++ - 'A';
if (letter_group < 0) // Issue #103, if gets negative, fix it
if (letter_group < 0)
letter_group += 256;
if ((n_bytes = IsLetterGroup(tr, post_ptr-1, letter_group, 0)) > 0) {
add_points = (20-distance_right);
@@ -1927,7 +1925,9 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
failed = 1;
break;
case RULE_LETTERGP2: // match against a list of utf-8 strings
letter_group = *rule++ - 'A';
letter_group = *rule++ - 'A'; // substracting 'A' makes letter_group equal to number in .Lxx definition
if(letter_group<0)
letter_group += 256;
if ((n_bytes = IsLetterGroup(tr, pre_ptr, letter_group, 1)) > 0) {
add_points = (20-distance_right);
pre_ptr -= (n_bytes-1);

Loading…
Cancel
Save