2
2
Copyright (c) 1993-2008, Cognitive Technologies
5
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
6
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
8
* ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
9
���� ����������� �� ��������� �����, ���� ������ ������� � �����������
11
* ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
12
������ ����������, ������������ ��� ���������������, ������ �����������
13
��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
14
����������� ����� �� ��������.
15
* �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
16
���� ������������ � �������� �������� ��������� �/��� �����������
17
���������, ���������� �� ���� ��, ��� ���������������� �����������
20
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
21
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
22
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
23
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
24
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
25
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
26
������������� ������, ��������� � �������������� ��� ���������� ����������
27
������������� ������������� ��������� (������� ������ ������, ��� ������,
28
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
29
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
30
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
31
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
5
пЮГПЕЬЮЕРЯЪ ОНБРНПМНЕ ПЮЯОПНЯРПЮМЕМХЕ Х ХЯОНКЭГНБЮМХЕ ЙЮЙ Б БХДЕ ХЯУНДМНЦН ЙНДЮ,
6
РЮЙ Х Б ДБНХВМНИ ТНПЛЕ, Я ХГЛЕМЕМХЪЛХ ХКХ АЕГ, ОПХ ЯНАКЧДЕМХХ ЯКЕДСЧЫХУ СЯКНБХИ:
8
* оПХ ОНБРНПМНЛ ПЮЯОПНЯРПЮМЕМХХ ХЯУНДМНЦН ЙНДЮ ДНКФМШ НЯРЮБЮРЭЯЪ СЙЮГЮММНЕ
9
БШЬЕ СБЕДНЛКЕМХЕ НА ЮБРНПЯЙНЛ ОПЮБЕ, ЩРНР ЯОХЯНЙ СЯКНБХИ Х ОНЯКЕДСЧЫХИ
11
* оПХ ОНБРНПМНЛ ПЮЯОПНЯРПЮМЕМХХ ДБНХВМНЦН ЙНДЮ Б ДНЙСЛЕМРЮЖХХ Х/ХКХ Б
12
ДПСЦХУ ЛЮРЕПХЮКЮУ, ОНЯРЮБКЪЕЛШУ ОПХ ПЮЯОПНЯРПЮМЕМХХ, ДНКФМШ ЯНУПЮМЪРЭЯЪ
13
СЙЮГЮММЮЪ БШЬЕ ХМТНПЛЮЖХЪ НА ЮБРНПЯЙНЛ ОПЮБЕ, ЩРНР ЯОХЯНЙ СЯКНБХИ Х
14
ОНЯКЕДСЧЫХИ НРЙЮГ НР ЦЮПЮМРХИ.
15
* мХ МЮГБЮМХЕ Cognitive Technologies, МХ ХЛЕМЮ ЕЕ ЯНРПСДМХЙНБ МЕ ЛНЦСР
16
АШРЭ ХЯОНКЭГНБЮМШ Б ЙЮВЕЯРБЕ ЯПЕДЯРБЮ ОНДДЕПФЙХ Х/ХКХ ОПНДБХФЕМХЪ
17
ОПНДСЙРНБ, НЯМНБЮММШУ МЮ ЩРНЛ он, АЕГ ОПЕДБЮПХРЕКЭМНЦН ОХЯЭЛЕММНЦН
20
щрю опнцпюллю опеднярюбкемю бкюдекэжюлх юбрнпяйху опюб х/хкх дпсцхлх кхжюлх "йюй
21
нмю еярэ" аег йюйнцн-кхан бхдю цюпюмрхи, бшпюфеммшу ъбмн хкх ондпюгслебюелшу,
22
бйкчвюъ цюпюмрхх йнллепвеяйни жеммнярх х опхцндмнярх дкъ йнмйпермни жекх, мн ме
23
нцпюмхвхбюъяэ хлх. мх бкюдекеж юбрнпяйху опюб х мх ндмн дпсцне кхжн, йнрнпне
24
лнфер хглемърэ х/хкх онбрнпмн пюяопнярпюмърэ опнцпюллс, мх б йнел яксвюе ме
25
мея╗р нрберярбеммнярх, бйкчвюъ кчаше наыхе, яксвюимше, яоежхюкэмше хкх
26
онякеднбюбьхе сашрйх, ябъгюммше я хяонкэгнбюмхел хкх онмеяеммше бякедярбхе
27
мебнглнфмнярх хяонкэгнбюмхъ опнцпюллш (бйкчвюъ онрепх дюммшу, хкх дюммше,
28
ярюбьхе мецндмшлх, хкх сашрйх х/хкх онрепх днунднб, онмеяеммше хг-гю деиярбхи
29
рперэху кхж х/хкх нрйюгю опнцпюллш пюанрюрэ янблеярмн я дпсцхлх опнцпюллюлх,
30
мн ме нцпюмхвхбюъяэ щрхлх яксвюълх), мн ме нцпюмхвхбюъяэ хлх, дюфе еякх рюйни
31
бкюдекеж хкх дпсцне кхжн ашкх хгбеыемш н бнглнфмнярх рюйху сашрйнб х онрепэ.
33
33
Redistribution and use in source and binary forms, with or without modification,
34
34
are permitted provided that the following conditions are met:
96
95
struct res_recog RR;
97
extern CHAR *tableBOX;
98
extern PBYTE fontBOX/*,auto_pool*/; /* BOX table for font */
99
PBYTE omniBOX; /* BOX save table for omni */
96
extern char *tableBOX;
97
extern puchar fontBOX/*,auto_pool*/; /* BOX table for font */
98
puchar omniBOX; /* BOX save table for omni */
102
static void store_bests(INT);
103
static void store_all_bests(INT);
100
int16_t best_answer_BOX;
101
static void store_bests(int16_t);
102
static void store_all_bests(int16_t);
104
103
static indBOX *wiptr, *indp;
107
CHAR forbidBOX[]={"&#@!-."};
108
CHAR *db_m1[]={"3x3 tab","3x7 tbl", "5x11 t","7x13 march","16x16 cell"};
110
static PBYTE full_list[512];
111
static PBYTE font_full_list[512];
112
static PBYTE omni_full_list[512];
106
char forbidBOX[]={"&#@!-."};
107
char *db_m1[]={"3x3 tab","3x7 tbl", "5x11 t","7x13 march","16x16 cell"};
109
static puchar full_list[512];
110
static puchar font_full_list[512];
111
static puchar omni_full_list[512];
120
119
typedef struct list_BOX LST;
121
static void store_new_bests(WORD ibcos, CHAR pl, CHAR ff,CHAR n_rsn);
124
INT isKlasterFull( INT typl )
120
static void store_new_bests(uint16_t ibcos, char pl, char ff,char n_rsn);
123
int16_t isKlasterFull( int16_t typl )
126
125
if( ((LST *)(full_list[typl]))->let ) // yes such letter in table
137
136
case 'x': case 'c': case 'v':
138
137
case 's': case 'w':
139
138
if (typl & 1) store_new_bests(ibcos,let,ff,-1); // small
140
if (typl & 2) store_new_bests(ibcos,(CHAR)(let +'A' -'a'),ff,-1); // capital
139
if (typl & 2) store_new_bests(ibcos,(char)(let +'A' -'a'),ff,-1); // capital
143
142
case 'X': case 'C': case 'V':
144
143
case 'S': case 'W':
145
if (typl & 1) store_new_bests(ibcos,(CHAR)(let +'a' -'A'),ff,-1); // small
144
if (typl & 1) store_new_bests(ibcos,(char)(let +'a' -'A'),ff,-1); // small
146
145
if (typl & 2) store_new_bests(ibcos,let,ff,-1); // capital
174
173
case c_bottom_accent :
175
174
case CC_bottom_accent :
177
// ����������� ���� 17.07.2001 E.P.
176
// йНМТКХЙРМШЕ ЙНДШ 17.07.2001 E.P.
178
177
if (is_baltic_language(language))
181
if (typl & 4) store_new_bests(ibcos,(CHAR)c_bottom_accent,ff,-1);
182
if (typl & (2+8)) store_new_bests(ibcos,(CHAR)CC_bottom_accent,ff,-1);
180
if (typl & 4) store_new_bests(ibcos,(char)c_bottom_accent,ff,-1);
181
if (typl & (2+8)) store_new_bests(ibcos,(char)CC_bottom_accent,ff,-1);
188
static void store_new_bests(WORD ibcos, CHAR pl, CHAR ff,CHAR n_rsn)
187
static void store_new_bests(uint16_t ibcos, char pl, char ff,char n_rsn)
190
189
// This procedure stores best NBEST answers in rec_recog.
391
390
while( (wmatr = *(elmBOX **)klist) != NULL )
393
probest=(WORD)((*scalar)(wmatr->vect,vect)>>15);
394
if (probest > (WORD) (ans_ptr->iprob))
392
probest=(uint16_t)((*scalar)(wmatr->vect,vect)>>15);
393
if (probest > (uint16_t) (ans_ptr->iprob))
396
if (probest > (WORD) best_answer_BOX) best_answer_BOX=probest;
395
if (probest > (uint16_t) best_answer_BOX) best_answer_BOX=probest;
397
396
ans_ptr->fnt=wmatr->fnt;
398
397
ans_ptr->iprob=probest;
399
ans_ptr->n_rsn=(CHAR)cnt;
398
ans_ptr->n_rsn=(char)cnt;
402
klist += sizeof(PBYTE *);
401
klist += sizeof(puchar *);
403
402
}// while end (all versions of one letter)
409
408
if( !(wmatr->bnd&0x200) )
411
probest=(WORD)((*scalar)(wmatr->vect,vect)>>15);
412
if (probest > (WORD) (ans_ptr->iprob))
410
probest=(uint16_t)((*scalar)(wmatr->vect,vect)>>15);
411
if (probest > (uint16_t) (ans_ptr->iprob))
414
if (probest > (WORD) best_answer_BOX)
413
if (probest > (uint16_t) best_answer_BOX)
415
414
best_answer_BOX=probest;
416
415
ans_ptr->fnt=wmatr->fnt;
417
416
ans_ptr->iprob=probest;
418
ans_ptr->n_rsn=(CHAR)cnt;
417
ans_ptr->n_rsn=(char)cnt;
422
klist += sizeof(PBYTE *);
421
klist += sizeof(puchar *);
423
422
}// while end (all versions of one letter)
509
508
if (flprop && !(wmatr->bnd&0x200) )
512
i = (INT)((*scalar)(wmatr->vect,vect)>>15);
511
i = (int16_t)((*scalar)(wmatr->vect,vect)>>15);
514
if ((WORD)i > (WORD)curr_cosinus)
513
if ((uint16_t)i > (uint16_t)curr_cosinus)
516
if ((WORD)i == 32767)i=32766;
517
if ((WORD)i > 32767) i=32767;
518
*(PBYTE)(&curr_font)=wmatr->fnt;
515
if ((uint16_t)i == 32767)i=32766;
516
if ((uint16_t)i > 32767) i=32767;
517
*(puchar)(&curr_font)=wmatr->fnt;
519
518
*(PWORD)(&curr_cosinus)=i;
524
list += sizeof(PBYTE *);
523
list += sizeof(puchar *);
525
524
} // while all letter's list entries
707
706
free += sizeof(LST);
710
//wmatr=(elmBOX *)((PBYTE)matr+wiptr->numel);
709
//wmatr=(elmBOX *)((puchar)matr+wiptr->numel);
711
710
wmatr=matr+wiptr->numel;
715
714
if( ( (wmatr->bnd/256) & 0x01 ) == 0 ){
716
*(PBYTE *)free = (PBYTE) wmatr; free += sizeof(PBYTE *);
715
*(puchar *)free = (puchar) wmatr; free += sizeof(puchar *);
718
717
list = wmatr->list;
719
718
if (!list) break;
720
//wmatr=(elmBOX *)((PBYTE)matr+list);
719
//wmatr=(elmBOX *)((puchar)matr+list);
721
720
wmatr=(elmBOX *)matr+list;
724
723
if (flp == 0) goto lwrs; // not a paired letter
725
724
if (letagain(curlet,1) && wiptr) goto rwrk;
727
*((PBYTE *)free) = NULL; free += sizeof (PBYTE *);
726
*((puchar *)free) = NULL; free += sizeof (puchar *);
729
728
if ((typl & 256) == 0)
752
751
free = list_BOX(free,i);
754
753
//for two tables 3x5
755
memcpy(omni_full_list,full_list,512*sizeof(PBYTE));
754
memcpy(omni_full_list,full_list,512*sizeof(puchar));
756
755
omniBOX = tableBOX;
762
void load_font( INT font )
761
void load_font( int16_t font )
766
memcpy(full_list,font_full_list,512*sizeof(PBYTE));
765
memcpy(full_list,font_full_list,512*sizeof(puchar));
767
766
tableBOX = fontBOX;
770
memcpy(full_list,omni_full_list,512*sizeof(PBYTE));
769
memcpy(full_list,omni_full_list,512*sizeof(puchar));
771
770
tableBOX = omniBOX;