~ubuntu-branches/ubuntu/vivid/chasen/vivid

« back to all changes in this revision

Viewing changes to lib/chadic.h

  • Committer: Bazaar Package Importer
  • Author(s): NOKUBI Takatsugu
  • Date: 2004-07-12 17:04:30 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040712170430-qd9g2og0261n6h8j
Tags: 2.3.3-5
Fixed non-ISO C++ compliant code, closes: #258568.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * chadic.h
3
3
 *     1990/12/06/Thu  Yutaka MYOKI(Nagao Lab., KUEE)
4
4
 *
5
 
 * $Id: chadic.h,v 1.18.4.1 2002/02/05 13:42:07 akira-k Exp $
 
5
 * $Id: chadic.h,v 1.43 2003/08/13 13:55:19 kazuma-t Exp $
6
6
 */
7
7
 
8
8
#ifndef __CHADIC_H__
20
20
#include <sys/types.h>
21
21
#endif /* HAVE_UNISTD_H */
22
22
 
23
 
#include "pat.h"
24
 
#include "sufary.h"
25
 
 
26
23
#ifndef FALSE
27
24
#define FALSE  ((int)0)
28
25
#endif
49
46
#define TYPE_NUM                256
50
47
#define FORM_NUM                128
51
48
 
52
 
#define JSTR_BOS             "ʸƬ"
53
 
#define ESTR_BOS             "BOS"
54
 
#define JSTR_EOS             "ʸ��"
55
 
#define ESTR_EOS             "EOS"
56
 
#define JSTR_BKUGIRI         "/"
57
 
#define ESTR_BOS_EOS         "BOS/EOS"
58
 
 
59
 
/* cforms.cha */
60
 
#define JSTR_BASE_FORM_STR   "���ܷ�"
61
 
#define ESTR_BASE_FORM_STR1  "BASEFORM"
62
 
#define ESTR_BASE_FORM_STR2  "STEMFORM"
63
 
#define JSTR_BASE_FORM       "���ܷ�"
64
 
#define ESTR_BASE_FORM1      "BASEFORM"
65
 
#define ESTR_BASE_FORM2      "STEMFORM"
66
 
 
67
 
/* *.dic */
68
 
#define JSTR_DEF_POS_COST  "�ǥե�����ʻ쥳����"
69
 
#define ESTR_DEF_POS_COST  "DEF_POS_COST"
70
 
#define JSTR_MRPH          "������"
71
 
#define ESTR_MRPH          "MORPH"
72
 
#define JSTR_POS           "�ʻ�"
73
 
#define ESTR_POS           "POS"
74
 
#define JSTR_WORD          "���Ф���"
75
 
#define ESTR_WORD          "LEX"
76
 
#define JSTR_READING       "�ɤ�"
77
 
#define ESTR_READING       "READING"
78
 
#define JSTR_BASE          "����"
79
 
#define ESTR_BASE          "BASE"
80
 
#define JSTR_PRON          "ȯ��"
81
 
#define ESTR_PRON          "PRON"
82
 
#define JSTR_CTYPE         "���ѷ�"
83
 
#define ESTR_CTYPE         "CTYPE"
84
 
#define JSTR_CFORM         "���ѷ�"
85
 
#define ESTR_CFORM         "CFORM"
86
 
#define JSTR_INFO1         "�ղþ���"
87
 
#define JSTR_INFO2         "��̣����"
88
 
#define ESTR_INFO          "INFO"
89
 
#define JSTR_COMPOUND      "ʣ���"
90
 
#define ESTR_COMPOUND      "COMPOUND"
91
 
#define JSTR_SEG           "������"
92
 
#define ESTR_SEG           "SEG"
93
 
#define JSTR_CONN_ATTR     "Ϣ��°��"
94
 
 
95
 
/* chasenrc */
96
 
#define JSTR_GRAM_FILE      "ʸˡ�ե�����"
97
 
#define ESTR_GRAM_FILE      "GRAMMAR"
98
 
#define JSTR_UNKNOWN_WORD1  "̤�θ�"
99
 
#define JSTR_UNKNOWN_WORD2  "̤�����"
100
 
#define ESTR_UNKNOWN_WORD   "UNKNOWN"
101
 
#define JSTR_UNKNOWN_WORD   JSTR_UNKNOWN_WORD1
102
 
#define JSTR_UNKNOWN_POS1   "̤�θ��ʻ�"
103
 
#define JSTR_UNKNOWN_POS2   "̤������ʻ�"
104
 
#define ESTR_UNKNOWN_POS    "UNKNOWN_POS"
105
 
#define JSTR_SPACE_POS      "�����ʻ�"
106
 
#define ESTR_SPACE_POS      "SPACE_POS"
107
 
#define JSTR_ANNOTATION     "����"
108
 
#define ESTR_ANNOTATION     "ANNOTATION"
109
 
#define JSTR_POS_COST       "�ʻ쥳����"
110
 
#define ESTR_POS_COST       "POS_COST"
111
 
#define JSTR_CONN_WEIGHT    "Ϣ�ܥ����ȽŤ�"
112
 
#define ESTR_CONN_WEIGHT    "CONN_WEIGHT"
113
 
#define JSTR_MRPH_WEIGHT    "�����ǥ����ȽŤ�"
114
 
#define ESTR_MRPH_WEIGHT    "MORPH_WEIGHT"
115
 
#define JSTR_COST_WIDTH     "��������"
116
 
#define ESTR_COST_WIDTH     "COST_WIDTH"
117
 
#define JSTR_DEF_CONN_COST  "̤���Ϣ�ܥ�����"
118
 
#define ESTR_DEF_CONN_COST  "DEF_CONN_COST"
119
 
#define JSTR_COMPOSIT_POS      "Ϣ���ʻ�"
120
 
#define ESTR_COMPOSIT_POS      "COMPOSIT_POS"
121
 
#define JSTR_OUTPUT_COMPOUND   "ʣ������"
122
 
#define ESTR_OUTPUT_COMPOUND   "OUTPUT_COMPOUND"
123
 
#define ESTR_PAT_FILE       "PATDIC" /* changed by Tatuo 960920 */
124
 
#define ESTR_SUF_FILE       "SUFDIC"
125
 
#define JSTR_OUTPUT_FORMAT  "���ϥե����ޥå�"
126
 
#define ESTR_OUTPUT_FORMAT  "OUTPUT_FORMAT"
127
 
#define JSTR_LANG           "����"
128
 
#define ESTR_LANG           "LANG"
129
 
#define JSTR_DELIMITER      "���ڤ�ʸ��"
130
 
#define ESTR_DELIMITER      "DELIMITER"
131
 
#define JSTR_BOS_STR        "BOSʸ����"
132
 
#define ESTR_BOS_STR        "BOS_STRING"
133
 
#define JSTR_EOS_STR        "EOSʸ����"
134
 
#define ESTR_EOS_STR        "EOS_STRING"
135
 
 
136
49
#define VCHA_CONNECT_FILE "connect.cha"
137
50
#define VCHA_CONNTMP_FILE "_connect.cha"
138
51
#define VCHA_GRAMMAR_FILE "grammar.cha"
173
86
/* added by S.Kurohashi for mrph weight default values */
174
87
#define MRPH_DEFAULT_WEIGHT     1
175
88
 
176
 
#define strmatch2(s,s1,s2)      (!strcmp(s,s1)||!strcmp(s,s2))
177
 
#define strmatch3(s,s1,s2,s3)   (!strcmp(s,s1)||!strcmp(s,s2)||!strcmp(s,s3))
178
 
 
179
89
/*
180
90
 * structures
181
91
 */
203
113
 
204
114
/* this structure is used only in mkchadic */
205
115
/* morpheme */
206
 
typedef struct _mrph {
207
 
    char midasi[MIDASI_LEN];  /* surface form */
208
 
    char yomi[MIDASI_LEN];    /* Japanese reading */
 
116
typedef struct _lexicon_t {
 
117
    char headword[MIDASI_LEN];  /* surface form */
 
118
    short stem_len;
 
119
    char reading[MIDASI_LEN * 2];    /* Japanese reading *//* XXX ad hoc */
 
120
    short reading_len;
 
121
    char pron[MIDASI_LEN * 2];    /* Japanese pronunciation *//* XXX ad hoc */
 
122
    short pron_len;
 
123
    char *base;               /* base form */
 
124
    unsigned short pos;     /* POS number */
 
125
    unsigned char inf_type;      /* Conjugation type number */
 
126
    unsigned char inf_form;      /* Conjugation form number */
 
127
 
209
128
    char *info;               /* semantic information */
210
 
    char *base;               /* base form */
211
 
    char pron[MIDASI_LEN];    /* Japanese pronunciation */
212
 
    unsigned short hinsi;     /* POS number */
213
 
    unsigned char ktype;      /* Conjugation type number */
214
 
    unsigned char kform;      /* Conjugation form number */
215
129
 
216
130
    short con_tbl;            /* connection table number */
217
 
    short length;             /* the length of surface form */
218
131
    unsigned short weight;    /* cost for morpheme  */
219
132
 
220
 
    char is_undef;            /* the unseen word or not */
221
 
} mrph_t;
 
133
} lexicon_t;
222
134
 
223
135
/* POS information -- see also the comments (the end of this file) */
224
136
typedef struct _hinsi_t {
225
137
    short *path;         /* the path to top node */
226
138
    short *daughter;     /* the daughter node */
227
139
    char  *name;         /* the name of POS (at the level) */
228
 
    char  *bkugiri;      /* for bunsetsu segmentation */
229
140
    short composit;      /* for the COMPOSIT_POS */ 
230
141
    char  depth;         /* the depth from top node */
231
142
    char  kt;            /* have conjugation or not */
273
184
extern int Cha_optind;
274
185
extern char *Cha_optarg;
275
186
 
276
 
extern int Cha_server_mode;
277
187
extern int Cha_errno;
278
188
extern FILE *Cha_stderr;
279
189
 
280
 
/* dictionaries(dic.c) */
281
 
extern SUFARY *Suf_dicfile[];
282
 
extern pat_t *Pat_dicfile[];
283
 
extern int Suf_ndicfile;
284
 
extern int Pat_ndicfile;
285
 
 
286
190
/*
287
191
 * functions
288
192
 */
309
213
void cha_exit_perror(char*);
310
214
FILE *cha_fopen_rcfile(void);
311
215
void cha_read_grammar_dir(void);
 
216
char *cha_read_registry(char*, char*, char*);
312
217
 
313
218
/* lisp.c */
314
 
void cha_set_getc_alone(void);
315
 
void cha_set_getc_server(void);
316
219
void cha_set_skip_char(int);
317
220
int cha_s_feof(FILE*);
318
221
void cha_s_free(chasen_cell_t*);
338
241
 
339
242
/* connect.c */
340
243
void cha_read_table(FILE*, int);
341
 
int cha_check_table(mrph_t*); /* 970301 tatuo: void -> int for ��� */
 
244
int cha_check_table(lexicon_t*); /* 970301 tatuo: void -> int for ��� */
342
245
int cha_check_table_for_undef(int);
343
246
void cha_read_matrix(FILE*);
344
247
int cha_check_automaton(int, int, int, int*);
345
 
/* for EDR dic */
346
 
void cha_check_edrtable(mrph_t *, chasen_cell_t*);
347
 
void cha_check_edrtable_str(mrph_t*, char*); /* Unused.  */
348
248
 
349
249
/* getid.c */
350
250
int cha_get_nhinsi_str_id(char**);
352
252
int cha_get_type_id(char*);
353
253
int cha_get_form_id(char*, int);
354
254
 
355
 
/* zentohan.c */
356
 
unsigned char *euc2sjis(char*);
357
 
unsigned char *sjis2euc(unsigned char*);
358
 
unsigned char *hankana2zenkana(unsigned char*);
359
 
 
360
255
/* getopt.c */
361
256
int cha_getopt(char**, char*, FILE*);
362
257
int cha_getopt_chasen(char**, FILE*);
363
258
 
364
 
/* mmap.c */
365
 
off_t cha_mmap_file(char*, void**);
366
 
off_t cha_mmap_file_w(char*, void**);
367
 
void cha_munmap_file(void*, off_t);
368
 
 
369
259
#endif /* __CHADIC_H__ */
370
260
 
371
261