NIIBE Yutaka
gniib****@fsij*****
2010年 7月 1日 (木) 10:27:57 JST
ブランチ janitor/segclass-eucjp-literal-removal として、下記の変更を行 いました。 anthy_seg_class_name は Debug 出力としてのみ使っているので、 日本語を含まない anthy_seg_class_sym を使うことにしています。 diff --git a/anthy/segclass.h b/anthy/segclass.h index b8a2724..b58113e 100644 --- a/anthy/segclass.h +++ b/anthy/segclass.h @@ -43,8 +43,5 @@ enum seg_class { SEG_SIZE }; -const char* anthy_seg_class_name(enum seg_class sc); const char* anthy_seg_class_sym(enum seg_class sc); -enum seg_class anthy_seg_class_by_name(const char *name); - #endif diff --git a/src-splitter/lattice.c b/src-splitter/lattice.c index 0387727..0d1cab2 100644 --- a/src-splitter/lattice.c +++ b/src-splitter/lattice.c @@ -193,7 +193,7 @@ calc_probability(int cc, struct feature_list *fl) if (anthy_splitter_debug_flags() & SPLITTER_DEBUG_LN) { anthy_feature_list_print(fl); - printf(" cc=%d(%s), P=%f\n", cc, anthy_seg_class_name(cc), prob); + printf(" cc=%d(%s), P=%f\n", cc, anthy_seg_class_sym(cc), prob); } return prob; } diff --git a/src-splitter/metaword.c b/src-splitter/metaword.c index 0491035..723a677 100644 --- a/src-splitter/metaword.c +++ b/src-splitter/metaword.c @@ -93,7 +93,7 @@ anthy_do_print_metaword(struct splitter_context *sc, printf("*meta word type=%s(%d-%d):score=%d:seg_class=%s", anthy_metaword_type_tab[mw->type].name, mw->from, mw->len, mw->score, - anthy_seg_class_name(mw->seg_class)); + anthy_seg_class_sym(mw->seg_class)); print_metaword_features(mw->mw_features); printf(":can_use=%d*\n", mw->can_use); if (mw->wl) { diff --git a/src-splitter/segclass.c b/src-splitter/segclass.c index 6b440a4..f4dc02a 100644 --- a/src-splitter/segclass.c +++ b/src-splitter/segclass.c @@ -5,19 +5,24 @@ #include <anthy/segclass.h> #include "wordborder.h" -static struct { - const char *name; - const char *sym; -} seg_class_tab[] = { - {"文頭", "H"}, {"文末", "T"}, {"文節", "B"}, - {"接続語", "C"}, {"名詞+格助詞", "Nk"}, {"名詞+終端", "Ne"}, - {"動詞+付属語", "Vf"}, {"動詞+終端", "Ve"}, {"形容詞", "A"}, - {"形容動詞", "AJV"}, - {"連用修飾", "YM"}, {"連体修飾", "TM"}, - {"名詞", "N"}, {"名詞+付属語", "Nf"}, {"名詞+連用", "Ny"}, - {"動詞+連用", "Vy"}, - {"動詞+連体", "Vt"}, - {NULL, NULL} +const char *seg_class_tab[] = { + "H" /* Head of sentence: Buntou */ + "T" /* Tail of sentence: Bunmatsu */ + "B" /* Segment: Bunsetsu */ + "C" /* Setsuzokugo */ + "Nk" /* Meishi+Kakujoshi */ + "Ne" /* Meishi+Shuutan */ + "Vf" /* Doushi+Fuzokugo */ + "Ve" /* Doushi+Shuutan */ + "A" /* Keiyoushi */ + "AJV" /* Keiyoudoushi */ + "YM" /* RenyouShuushoku */ + "TM" /* RentaiShuushoku */ + "N" /* Meishi */ + "Nf" /* Meishi+Fuzokugo */ + "Ny" /* Meishi+Renyou */ + "Vy" /* Doushi+Renyou */ + "Vt" /* Doushi+Rentai */ }; void @@ -107,24 +112,7 @@ anthy_set_seg_class(struct word_list* wl) wl->seg_class = seg_class; } -const char* anthy_seg_class_name(enum seg_class sc) -{ - return seg_class_tab[sc].name; -} - const char* anthy_seg_class_sym(enum seg_class sc) { - return seg_class_tab[sc].sym; -} - -enum seg_class -anthy_seg_class_by_name(const char *name) -{ - int i; - for (i = 0; seg_class_tab[i].name; i++) { - if (!strcmp(seg_class_tab[i].name, name)) { - return i; - } - } - return SEG_BUNSETSU; + return seg_class_tab[sc]; } diff --git a/src-splitter/wordlist.c b/src-splitter/wordlist.c index 58c60bf..f677a3c 100644 --- a/src-splitter/wordlist.c +++ b/src-splitter/wordlist.c @@ -65,7 +65,7 @@ anthy_print_word_list(struct splitter_context *sc, wl->part[PART_POSTFIX].len].c; anthy_putxstr(&xs); anthy_print_wtype(wl->part[PART_CORE].wt); - printf(" %s%s\n", anthy_seg_class_name(wl->seg_class), + printf(" %s%s\n", anthy_seg_class_sym(wl->seg_class), (wl->is_compound ? ",compound" : "")); } --