summaryrefslogtreecommitdiff
path: root/anthy/convdb.h
blob: 014a8ee0219f6856ad21b5483e349ef914589709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* 変換結果のデータベース */
#ifndef _convdb_h_included_
#define _convdb_h_included_

#include <anthy/anthy.h>

/* 不明, OK, 誤変換, don't careの4つのカテゴリーに分類する */
#define CHK_UNKNOWN 0
#define CHK_OK 1
#define CHK_MISS 2
#define CHK_DONTCARE 3

/**/
#define CONV_OK 0
#define CONV_SIZE_MISS 1
#define CONV_CAND_MISS 2
#define CONV_INVALID 4

/* 変換前と変換後の文字列、結果に対する判定を格納する */
struct conv_res {
  /* 検索のキー */
  char *src_str;
  char *res_str;
  /* 候補を割り当てたもの */
  char *cand_str;
  /**/
  int *cand_check;
  /**/
  int check;
  int used;
  /**/
  struct conv_res *next;
};

/* 変換結果のカウント */
struct res_stat {
  int unknown;
  int ok;
  int miss;
  int dontcare;
};

/* 変換結果のデータベース */
struct res_db {
  /**/
  struct conv_res res_list;
  struct conv_res *tail;
  /**/
  int total;
  struct res_stat res, split;
};

struct res_db *create_db(void);
void read_db(struct res_db *db, const char *fn);
struct conv_res *find_conv_res(struct res_db *db, anthy_context_t ac,
			       const char *src, int conv);
void print_size_miss_segment_info(anthy_context_t ac, int nth);
void print_cand_miss_segment_info(anthy_context_t ac, int nth);
void print_context_info(anthy_context_t ac, struct conv_res *cr);

#endif