diff --git a/include/sj4core/sj_struct.h b/include/sj4core/sj_struct.h index 0d50525..c0d8999 100644 --- a/include/sj4core/sj_struct.h +++ b/include/sj4core/sj_struct.h @@ -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 { diff --git a/lib/sj4core/getrank.c b/lib/sj4core/getrank.c index 14a6c2c..c7b7ae0 100644 --- a/lib/sj4core/getrank.c +++ b/lib/sj4core/getrank.c @@ -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 } diff --git a/lib/sj4core/setjrec.c b/lib/sj4core/setjrec.c index 4be9176..d2079c0 100644 --- a/lib/sj4core/setjrec.c +++ b/lib/sj4core/setjrec.c @@ -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); } diff --git a/lib/sj4core/srchnum.c b/lib/sj4core/srchnum.c index 7fe4cd0..e98147a 100644 --- a/lib/sj4core/srchnum.c +++ b/lib/sj4core/srchnum.c @@ -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; diff --git a/lib/sj4core/wakachi.c b/lib/sj4core/wakachi.c index 4f9fa15..d191dbc 100644 --- a/lib/sj4core/wakachi.c +++ b/lib/sj4core/wakachi.c @@ -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) {