Implement regetrank that might work
This commit is contained in:
parent
56a8381949
commit
871a152b12
5 changed files with 32 additions and 14 deletions
|
|
@ -43,15 +43,15 @@ typedef struct jiritu {
|
|||
TypeDicOfs jofsst;
|
||||
TypeDicOfs jofsed;
|
||||
u_short flags;
|
||||
TypeClass jclass;
|
||||
TypeDicID dicid;
|
||||
u_char jlen;
|
||||
TypeGram hinsi;
|
||||
u_char sttofs;
|
||||
u_char stbofs;
|
||||
u_char count;
|
||||
u_char numlen;
|
||||
u_short cost; /* new in SJ4 */
|
||||
TypeClass jclass;
|
||||
TypeDicID dicid;
|
||||
u_char jlen;
|
||||
TypeGram hinsi;
|
||||
u_char sttofs;
|
||||
u_char stbofs;
|
||||
u_char count;
|
||||
u_char numlen;
|
||||
u_short cost; /* new in SJ4 */
|
||||
} JREC;
|
||||
|
||||
typedef struct bunsetu {
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ regetrank(SJ4_CONTEXT2) {
|
|||
nkhcount = tmp = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
for(count = khcount, kptr = kouhotbl; count--; kptr++) {
|
||||
|
||||
if(!(kptr->rank)) {
|
||||
|
|
@ -150,4 +151,21 @@ regetrank(SJ4_CONTEXT2) {
|
|||
else if((short)kptr->rank >= nrank)
|
||||
kptr->rank += (u_char)nkhcount;
|
||||
}
|
||||
#else
|
||||
while(1) {
|
||||
KHREC* best = NULL;
|
||||
|
||||
for(count = khcount, kptr = kouhotbl; count--; kptr++) {
|
||||
if(kptr->rank != 0) continue;
|
||||
|
||||
if(best == NULL || kptr->cost < best->cost) {
|
||||
best = kptr;
|
||||
}
|
||||
}
|
||||
|
||||
if(best == NULL) break;
|
||||
|
||||
best->rank = trank++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ void setjrec(SJ4_CONTEXT u_char* tagp, int mode) {
|
|||
rec->jseg = prevseg;
|
||||
rec->jofsst = ptr - dicbuf;
|
||||
rec->jofsed = tmp - dicbuf;
|
||||
rec->jclass = C_DICT;
|
||||
rec->jclass = C_DICT;
|
||||
rec->dicid = curdict->dicid;
|
||||
rec->hinsi = gram;
|
||||
rec->sttofs = headcode;
|
||||
|
|
@ -323,6 +323,6 @@ void setcrec(SJ4_CONTEXT u_char* tagp) {
|
|||
if(!(rec = argjrec(SJ4_CONTEXT_PASS(int) ClYomiLen(tagp), (JREC*)NULL))) return;
|
||||
|
||||
rec->jofsst = tagp - CLSTUDYDICT;
|
||||
rec->jclass = C_BUNSETU;
|
||||
rec->jclass = C_BUNSETU;
|
||||
rec->hinsi = ClGramCode(tagp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ setnrec_sub(SJ4_CONTEXT u_char* p, u_short flag, int stb) {
|
|||
}
|
||||
|
||||
if((rec = argjrec(SJ4_CONTEXT_PASS len1, (JREC*)NULL))) {
|
||||
rec->jclass = suuji_class;
|
||||
rec->jclass = suuji_class;
|
||||
rec->hinsi = SUUSI;
|
||||
rec->sttofs = headcode;
|
||||
rec->stbofs = (u_char)stb;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void wakachi(SJ4_CONTEXT2) {
|
|||
if(!(jrec = argjrec(SJ4_CONTEXT_PASS i, (JREC*)NULL))) return;
|
||||
|
||||
jrec->jclass = C_WAKACHI;
|
||||
jrec->hinsi = D_MEISI_1;
|
||||
jrec->hinsi = D_MEISI_1;
|
||||
|
||||
if(Chrtbl[*(next - 1)] & TAI_KGU)
|
||||
srchfzk(SJ4_CONTEXT_PASS jrec, next, R_DAIMEISI, 0);
|
||||
|
|
@ -79,7 +79,7 @@ void wakachi(SJ4_CONTEXT2) {
|
|||
|
||||
if(!(jrec = argjrec(SJ4_CONTEXT_PASS 0, (JREC*)NULL))) return;
|
||||
jrec->jclass = C_WAKACHI;
|
||||
jrec->hinsi = MEISI_6;
|
||||
jrec->hinsi = MEISI_6;
|
||||
|
||||
while((int)jrec->jlen < maxlen) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue