1 /*
2  * 辞書モジュールのインターフェース
3  */
4 #ifndef _dic_h_included_
5 #define _dic_h_included_
6 
7 #include "xstr.h"
8 #include "wtype.h"
9 
10 /** 辞書の読みに対するハンドル(sequence entry) */
11 typedef struct seq_ent *seq_ent_t;
12 /***/
13 typedef struct dic_ent *compound_ent_t;
14 
15 /* 全体の初期化、解放 */
16 int anthy_init_dic(void);
17 void anthy_quit_dic(void);
18 
19 /* 他プロセスに対する排他制御 */
20 void anthy_lock_dic(void);
21 void anthy_unlock_dic(void);
22 
23 /**/
24 void anthy_gang_load_dic(xstr *xs, int is_reverse);
25 
26 /* 文字列の取得 */
27 seq_ent_t anthy_get_seq_ent_from_xstr(xstr *xs, int is_reverse);
28 /* 文字列の情報 */
29 int anthy_get_nr_dic_ents(seq_ent_t se, xstr *xs);
30 int anthy_has_compound_ents(seq_ent_t se);
31 int anthy_has_non_compound_ents(seq_ent_t se);
32 int anthy_get_nth_dic_ent_is_compound(seq_ent_t se, int nth);
33 /* 非複合語 */
34 /* caller should free @res */
35 int anthy_get_nth_dic_ent_str(seq_ent_t, xstr *orig, int, xstr *res);
36 int anthy_get_nth_dic_ent_freq(seq_ent_t, int nth);
37 int anthy_get_nth_dic_ent_wtype(seq_ent_t, xstr *, int nth, wtype_t *w);
38 /*  品詞 */
39 int anthy_get_seq_ent_pos(seq_ent_t, int pos);
40 int anthy_get_seq_ent_wtype_freq(seq_ent_t, wtype_t);
41 int anthy_get_seq_ent_indep(seq_ent_t se);
42 /* 複合語 */
43 compound_ent_t anthy_get_nth_compound_ent(seq_ent_t se, int nth);
44 int anthy_get_seq_ent_wtype_compound_freq(seq_ent_t se, wtype_t wt);
45 /**/
46 int anthy_compound_get_wtype(compound_ent_t, wtype_t *w);
47 int anthy_compound_get_freq(compound_ent_t ce);
48 int anthy_compound_get_nr_segments(compound_ent_t ce);
49 int anthy_compound_get_nth_segment_len(compound_ent_t ce, int nth);
50 int anthy_compound_get_nth_segment_xstr(compound_ent_t ce, int nth, xstr *xs);
51 
52 
53 
54 /** 辞書セッション
55  *
56  */
57 typedef struct mem_dic *dic_session_t;
58 /*typedef struct dic_session *dic_session_t;*/
59 
60 dic_session_t anthy_dic_create_session(void);
61 void anthy_dic_activate_session(dic_session_t );
62 void anthy_dic_release_session(dic_session_t);
63 
64 /* personality */
65 void anthy_dic_set_personality(const char *);
66 /**/
67 #define ANON_ID ""
68 
69 
70 /** 用例辞書
71  */
72 int anthy_dic_check_word_relation(int from, int to);
73 
74 /** 未知語の学習
75  */
76 void anthy_add_unknown_word(xstr *yomi, xstr *word);
77 void anthy_forget_unused_unknown_word(xstr *xs);
78 
79 #endif
80