A multilingual input method framework
Revision | bce0e5ffb40dcba1d2d1da00ac3cc55cf8a45ca2 (tree) |
---|---|
Time | 2006-07-03 20:37:26 |
Author | ekato <ekato@ff9a...> |
Commiter | ekato |
@@ -0,0 +1,402 @@ | ||
1 | +/* | |
2 | + * Copyright (c) 2003,2004 Masahito Omote <omote@utyuuzin.net> | |
3 | + * 2005-2006 uim Project http://uim.freedesktop.org/ | |
4 | + * | |
5 | + * All rights reserved. | |
6 | + * | |
7 | + * Redistribution and use in source and binary forms, with or without | |
8 | + * modification, are permitted provided that the following conditions | |
9 | + * are met: | |
10 | + * | |
11 | + * 1. Redistributions of source code must retain the above copyright | |
12 | + * notice, this list of conditions and the following disclaimer. | |
13 | + * 2. Redistributions in binary form must reproduce the above copyright | |
14 | + * notice, this list of conditions and the following disclaimer in the | |
15 | + * documentation and/or other materials provided with the distribution. | |
16 | + * 3. Neither the name of authors nor the names of its contributors | |
17 | + * may be used to endorse or promote products derived from this software | |
18 | + * without specific prior written permission. | |
19 | + * | |
20 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | |
21 | + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE | |
24 | + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | + * SUCH DAMAGE. | |
31 | + * | |
32 | + * This code is based on canna's code. For more information about canna, | |
33 | + * visit http://canna.sourceforge.jp/ . Canna license is as follows, | |
34 | + * | |
35 | + * Copyright (c) 2002 Canna Project. All rights reserved. | |
36 | + * | |
37 | + * Permission to use, copy, modify, distribute and sell this software | |
38 | + * and its documentation for any purpose is hereby granted without | |
39 | + * fee, provided that the above copyright notice appear in all copies | |
40 | + * and that both that copyright notice and this permission notice | |
41 | + * appear in supporting documentation, and that the name of the | |
42 | + * author and contributors not be used in advertising or publicity | |
43 | + * pertaining to distribution of the software without specific, written | |
44 | + * prior permission. The author and contributors no representations | |
45 | + * about the suitability of this software for any purpose. It is | |
46 | + * provided "as is" without express or implied warranty. | |
47 | + * | |
48 | + * THE AUTHOR AND CONTRIBUTORS DISCLAIMS ALL WARRANTIES WITH REGARD TO | |
49 | + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
50 | + * FITNESS, IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR | |
51 | + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER | |
52 | + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF | |
53 | + * CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN | |
54 | + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
55 | + * | |
56 | + * Copyright 1994 NEC Corporation, Tokyo, Japan. | |
57 | + * | |
58 | + * Permission to use, copy, modify, distribute and sell this software | |
59 | + * and its documentation for any purpose is hereby granted without | |
60 | + * fee, provided that the above copyright notice appear in all copies | |
61 | + * and that both that copyright notice and this permission notice | |
62 | + * appear in supporting documentation, and that the name of NEC | |
63 | + * Corporation not be used in advertising or publicity pertaining to | |
64 | + * distribution of the software without specific, written prior | |
65 | + * permission. NEC Corporation makes no representations about the | |
66 | + * suitability of this software for any purpose. It is provided "as | |
67 | + * is" without express or implied warranty. | |
68 | + * | |
69 | + * NEC CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
70 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | |
71 | + * NO EVENT SHALL NEC CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR | |
72 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |
73 | + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | |
74 | + * OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
75 | + * PERFORMANCE OF THIS SOFTWARE. | |
76 | + */ | |
77 | + | |
78 | +#include <config.h> | |
79 | + | |
80 | +#include <string.h> | |
81 | +#include "dict-canna-cclass.h" | |
82 | + | |
83 | +category_code substantive_code[]= { | |
84 | + { "#T00", "名詞(な,さ,する,語幹,格助接続)" , "共通,孝行", 31, 3 }, | |
85 | + { "#T01", "名詞(な,さ,する,語幹,格助接続△)", "", 31, 3 }, | |
86 | + { "#T02", "名詞(な,さ,する,語幹)" , "", 30, 3 }, | |
87 | + { "#T03", "名詞(な,さ,する,格助接続)" , "きちきち", 29, 3 }, | |
88 | + { "#T04", "名詞(な,さ,する)" , "凶暴", 28, 3 }, | |
89 | + { "#T05", "名詞(な,さ,語幹,格助接続)" , "質実,幸運,哀れ,簡潔,謙虚,貴重", 27, 3 }, | |
90 | + { "#T06", "名詞(な,さ,語幹,格助接続△)" , "一様,奇異,健やか,明快", 27, 3 }, | |
91 | + { "#T08", "名詞(な,さ,格助接続△)" , "意外,懸命", 25, 3 }, | |
92 | + { "#T09", "名詞(な,さ)" , "静か,気軽", 24, 3 }, | |
93 | + { "#T10", "名詞(な,する,語幹,格助接続)" , "安心,浮気,横着,感心", 23, 3 }, | |
94 | + { "#T11", "名詞(な,する,語幹,格助接続△)" , "格段,格別,大層,直接", 23, 3 }, | |
95 | + { "#T12", "名詞(な,する,語幹)" , "存分", 22, 3 }, | |
96 | + { "#T13", "名詞(な,する,格助接続△)" , "大慌て", 21, 3 }, | |
97 | + { "#T14", "名詞(な,する)" , "", 20, 3 }, | |
98 | + { "#T15", "名詞・副詞(な,語幹,格助接続)" , "同じ?,色々", 19, 3 }, | |
99 | + { "#T18", "名詞(な,格助接続△)" , "当り前,甘口,安穏,内気", 17, 3 }, | |
100 | + { "#T19", "名詞(な)" , "危なげ,嫌み,大ざっぱ", 16, 3 }, | |
101 | + { "#T20", "名詞(さ,する,語幹,格助接続)" , "", 15, 3 }, | |
102 | + { "#T21", "名詞(さ,する,語幹,格助接続△)" , "", 15, 3 }, | |
103 | + { "#T22", "名詞(さ,する,語幹)" , "", 14, 3 }, | |
104 | + { "#T23", "名詞(さ,する,格助接続△)" , "", 13, 3 }, | |
105 | + { "#T24", "名詞(さ,する)" , "", 12, 3 }, | |
106 | + { "#T25", "名詞(さ,語幹,格助接続)" , "平常", 11, 3 }, | |
107 | + { "#T26", "名詞(さ,語幹,格助接続△)" , "", 11, 3 }, | |
108 | + { "#T27", "名詞(さ,語幹)" , "", 10, 3 }, | |
109 | + { "#T28", "名詞(さ,格助接続△)" , "", 9, 3 }, | |
110 | + { "#T29", "名詞(さ)" , "", 8, 3 }, | |
111 | + { "#T30", "名詞(する,語幹,格助接続)" , "哀願,愛好,挨拶,安置", 7, 3 }, | |
112 | + { "#T32", "名詞(する,語幹)" , "", 6, 3 }, | |
113 | + { "#T33", "名詞(する,格助接続△)" , "", 5, 3 }, | |
114 | + { "#T34", "名詞(する)" , "", 4, 3 }, | |
115 | + { "#T35", "名詞(語幹,格助接続)" , "合印,合鍵,山,会社", 3, 3 }, | |
116 | + { "#T39", "名詞副詞(未定義)" , "", 0, 3 }, | |
117 | + { "#CN", "地名" , "東京", 0, 3 }, | |
118 | + { "#CNS", "地名(接尾語)" , "東京都", 0, 3 }, | |
119 | + { "#JCN", "地名(姓も可)" , "長崎", 0, 3 }, | |
120 | + { "#JN", "人名" , "菅井,勝", 0, 3 }, | |
121 | + { "#JNS", "人名(姓)" , "蔵本", 0, 3 }, | |
122 | + { "#JNM", "人名(名)" , "栄二", 0, 1 }, | |
123 | + { "#KK", "会社/団体" , "日本電気", 0, 3 }, | |
124 | +}; | |
125 | + | |
126 | +category_code adverb_code[] = { | |
127 | + { "#T07", "副詞(な,さ,語幹)" , "十分", 26, 3 }, | |
128 | + { "#T16", "副詞(な,語幹,格助接続△)" , "案外,生憎,かなり", 19, 3 }, | |
129 | + { "#T17", "副詞(な,語幹)" , "やたら,ぴったり,意識的,印象的,科学的", 18, 3 }, | |
130 | + { "#T31", "副詞(する,語幹,格助接続△)" , "ちょっと", 7, 3 }, | |
131 | + { "#T36", "副詞(語幹,格助接続△)" , "よほど,たぶん,折からの", 3, 3 }, | |
132 | + { "#T37", "副詞(語幹)" , "だいぶ,はなはだ", 2, 3 }, | |
133 | + { "#T38", "副詞(格助接続△)" , "", 1, 3 }, | |
134 | + | |
135 | + { "#F00", "副詞(と,たる,する,語幹)", "決然,ぐるぐる,ひそひそ,青々", 15, 3 }, | |
136 | + { "#F01", "副詞(と,たる,する)" , "判然,依然,公然,雑然,釈然,泰然", 14, 3 }, | |
137 | + { "#F02", "副詞(と,たる,語幹)" , "猛然,断然,断固,堂々,延々,延々", 13, 3 }, | |
138 | + { "#F03", "副詞(と,たる,)" , "広漠,安閑,憮然,唖然,黙々,切切", 12, 3 }, | |
139 | + { "#F04", "副詞(と,する,語幹)" , "ふっくら,ゆっくり", 11, 3 }, | |
140 | + { "#F05", "副詞(と,する)" , "晴れ晴れ,広々,ごわごわ,ごつごつ", 10, 3 }, | |
141 | + { "#F06", "副詞(と,語幹)" , "全然,突然,度々,重ね重ね,まざまざ,むざむざ", 9, 3 }, | |
142 | + { "#F07", "副詞(と)" , "", 8, 3 }, | |
143 | + { "#F08", "副詞(たる,する,語幹)" , "", 7, 3 }, | |
144 | + { "#F09", "副詞(たる,する)" , "", 6, 3 }, | |
145 | + { "#F10", "副詞(たる,語幹)" , "", 5, 3 }, | |
146 | + { "#F11", "副詞(たる)" , "確", 4, 3 }, | |
147 | + { "#F12", "副詞(する,語幹)" , "そっと,ぞっと,ほっと,ふと,ほっと,むっと", 3, 3 }, | |
148 | + { "#F13", "副詞(する)" , "", 2, 3 }, | |
149 | + { "#F14", "副詞(語幹)" , "相変わらず,敢えて,飽くまで", 1, 3 }, | |
150 | + { "#F15", "副詞(未定義)" , "", 0, 3 }, | |
151 | +}; | |
152 | + | |
153 | +/** | |
154 | + * K5, か行5段, 置く | |
155 | + * K5r, か行5段:連用形が名詞, 書く | |
156 | + * C5r, 行く5段:連用形が名詞, 行く | |
157 | + * G5, が行5段, 仰ぐ | |
158 | + * G5r, が行5段:連用形が名詞, 急ぐ | |
159 | + * S5, さ行5段, 帰す | |
160 | + * S5r, さ行5段:連用形が名詞, 移す | |
161 | + * T5, た行5段, 絶つ | |
162 | + * T5r, た行5段:連用形が名詞, 打つ | |
163 | + * N5, な行5段, 死ぬ | |
164 | + * B5, ば行5段, 転ぶ | |
165 | + * B5r, ば行5段:連用形が名詞, 遊ぶ | |
166 | + * M5, ま行5段, 住む | |
167 | + * M5r, ま行5段:連用形が名詞, 編む | |
168 | + * R5, ら行5段, 威張る | |
169 | + * R5r, ら行5段:連用形が名詞, 謝る | |
170 | + * L5, ラ行5段:命令形がイ, いらっしゃる | |
171 | + * W5, わ行5段, 言う | |
172 | + * W5r, わ行5段:連用形が名詞, 扱う | |
173 | + * U5, 乞う5段, 乞う | |
174 | + * U5r, 乞う5段:連用形が名詞, 問う | |
175 | + * KS, 上下1段, 降りる | |
176 | + * 与える | |
177 | + * KSr, 上下1段:語幹が名詞, 生きる | |
178 | + * 預ける | |
179 | + * KX, カ変活用動詞, 来る | |
180 | + * SX, サ変活用動詞, 関する | |
181 | + * ZX, ザ変活用動詞, 感ずる | |
182 | + * NZX, ンザ変活用動詞, 重んずる | |
183 | + **/ | |
184 | + | |
185 | +category_code verb_code[]= { | |
186 | + { "#K5", "か行5段" , "置/か(ない)/き(ます)/く/く(こと)/け(ば)/こ(う)", 0, 3 }, | |
187 | + { "#K5r", "か行5段:連名" , "書/か(ない)/き(ます)/く/く(こと)/け(ば)/こ(う)", 0, 3 }, | |
188 | + { "#C5r", "行く5段" , "行/か(ない)/き(ます)/く/く(こと)/け(ば)/こ(う)", 0, 3 }, | |
189 | + { "#G5" , "が行5段" , "仰/が(ない)/ぎ(ます)/ぐ/ぐ(こと)/げ(ば)/ご(う)", 0, 3 }, | |
190 | + { "#G5r", "が行5段:連名" , "急/が(ない)/ぎ(ます)/ぐ/ぐ(こと)/げ(ば)/ご(う)", 0, 3 }, | |
191 | + { "#S5" , "さ行5段" , "帰/さ(ない)/し(ます)/す/す(こと)/せ(ば)/そ(う)", 0, 3 }, | |
192 | + { "#S5r", "さ行5段:連名" , "移/さ(ない)/し(ます)/す/す(こと)/せ(ば)/そ(う)", 0, 3 }, | |
193 | + { "#T5" , "た行5段" , "絶/た(ない)/ち(ます)/つ/つ(こと)/て(ば)/と(う)", 0, 3 }, | |
194 | + { "#T5r", "た行5段:連名" , "打/た(ない)/ち(ます)/つ/つ(こと)/て(ば)/と(う)", 0, 3 }, | |
195 | + { "#N5", "な行5段" , "死/な(ない)/に(ます)/ぬ/ぬ(こと)/ね(ば)/の(う)", 0, 3 }, | |
196 | + { "#N5r", "な行5段:連名" , "", 0, 1 }, | |
197 | + { "#B5", "ば行5段" , "転/ば(ない)/び(ます)/ぶ/ぶ(こと)/べ(ば)/ぼ(う)", 0, 3 }, | |
198 | + { "#B5r", "ば行5段:連名" , "遊/ば(ない)/び(ます)/ぶ/ぶ(こと)/べ(ば)/ぼ(う)", 0, 3 }, | |
199 | + { "#M5", "ま行5段" , "住/ま(ない)/み(ます)/む/む(こと)/め(ば)/も(う)", 0, 3 }, | |
200 | + { "#M5r", "ま行5段:連名" , "編/ま(ない)/み(ます)/む/む(こと)/め(ば)/も(う)", 0, 3 }, | |
201 | + { "#R5" , "ら行5段" , "威張/ら(ない)/り(ます)/る/る(こと)/れ(ば)/ろ(う)", 0, 3 }, | |
202 | + { "#R5r", "ら行5段:連名" , "謝/ら(ない)/り(ます)/る/る(こと)/れ(ば)/ろ(う)", 0, 3 }, | |
203 | + { "#L5", "ラ行5段:命令イ", "いらっしゃ/ら(ない)/い(ます)/る/る(こと)/れ(ば)/ろ(う)", 0, 3 }, | |
204 | + { "#W5", "わ行5段" , "言/わ(ない)/い(ます)/う/う(こと)/え(ば)/お(う)", 0, 3 }, | |
205 | + { "#W5r", "わ行5段:連名" , "扱/わ(ない)/い(ます)/う/う(こと)/え(ば)/お(う)", 0, 3 }, | |
206 | + { "#U5" , "乞う5段" , "乞/わ(ない)/い(ます)/う/う(こと)/え(ば)/お(う)", 0, 3 }, | |
207 | + { "#U5r", "乞う5段:連名" , "問/わ(ない)/い(ます)/う/う(こと)/え(ば)/お(う)", 0, 3 }, | |
208 | + | |
209 | + { "#KS", "上下1段" , "降,与/り,え(ない)/り,え(ます)/りる,える/りる,える(こと)/りれ,えれ(ば)/りよ,えよ(う)", 0, 3 }, | |
210 | + { "#KSr", "上下1段:語幹名", "生,預/き,け(ない)/き,け(ます)/きる,ける/きる,ける(こと)/きれ,けれ(ば)/きよ,けよ(う)", 0, 3 }, | |
211 | + { "#KX", "カ変活用動詞" , "来/こ(ない)/き(ます)/くる/くる(こと)/くれ(ば)/こよ(う)", 0, 2 }, | |
212 | + { "#SX", "サ変活用動詞" , "関/し(ない)/し(ます)/する/する(こと)/すれ(ば)/せよ", 0, 3 }, | |
213 | + { "#ZX", "ザ変活用動詞" , "感/じ(ない)/じ(ます)/ずる/ずる(こと)/ずれ(ば)/ぜよ", 0, 3 }, | |
214 | + { "#NZX", "ンザ変活用動詞", "重ん/が(ない)/ぎ(ます)/ぐ/ぐ(こと)/げ(ば)/ご(う)", 0, 2 }, | |
215 | +}; | |
216 | + | |
217 | +/*** | |
218 | + * KY, 形 美しい | |
219 | + * KYT, 名ナノ・形 四角い,黄色い | |
220 | + * KYna, 形 小さい,大きい (活用に[な(連体用法ナ]がある形容詞) | |
221 | + * KYmi, 形 強い、重い (みで終ると名詞に転成する形容詞) | |
222 | + * KYme, 形 強め、長め (めで終ると形容動詞に転成する形容詞) | |
223 | + * KYmime,形 強み、強め KYmi, KYme の両方の性質を合わせ持つ | |
224 | + * KYU, 形:ウ音便 美しゅう | |
225 | + **/ | |
226 | + | |
227 | +category_code adjective_code[] = { | |
228 | + { "#KY", "形容詞" , "美しい", 0, 3 }, | |
229 | + { "#KYT", "形容詞:名ナノ" , "四角い, 黄色い", 0, 3 }, | |
230 | + { "#KYna", "形容詞:連体用法ナ", "小さい, 大きい", 0, 3 }, | |
231 | + { "#KYmi", "形容詞:み" , "強い, 重い", 0, 3 }, | |
232 | + { "#KYme", "形容詞:め" , "強め, 長め", 0, 3 }, | |
233 | + { "#KYmime", "形容詞:みめ" , "強み, 強め", 0, 3 }, | |
234 | + { "#KYU", "形容詞:ウ音便" , "美しゅう", 0, 3 }, | |
235 | +}; | |
236 | + | |
237 | +category_code etc_code[] = { | |
238 | + { "#KJ", "一文字漢字" , "単漢字変換用", 0, 3 }, | |
239 | +/* | |
240 | + { "#CN", "地名" , "東京", 0, 3 }, | |
241 | + { "#CNS", "地名(接尾語)" , "東京都", 0, 3 }, | |
242 | + { "#JCN", "地名(姓も可)" , "長崎", 0, 3 }, | |
243 | + { "#JN", "人名" , "菅井,勝", 0, 3 }, | |
244 | + { "#JNS", "人名(姓)" , "蔵本", 0, 3 }, | |
245 | + { "#JNM", "人名(名)" , "栄二", 0, 1 }, | |
246 | + { "#KK", "会社/団体" , "日本電気", 0, 3 }, | |
247 | +*/ | |
248 | + { "#CJ", "接続詞/感動詞/連語" , "", 0, 3 }, | |
249 | + { "#RT", "連体詞" , "", 0, 3 }, | |
250 | + { "#OKX", "動詞の丁寧表現の語幹" , "お聞き", 0, 3 }, | |
251 | + { "#NN", "数詞:一般" , "数,幾", 0, 3 }, | |
252 | + { "#N00", "数詞:x万,x億,x兆" , "x万,x億,x兆", 0, 3 }, | |
253 | + { "#N01", "数詞:千,二千,…,数千" , "千,二千,…,数千", 0, 3 }, | |
254 | + { "#N02", "数詞:百,二百,…,数百" , "百,二百,…,数百", 0, 3 }, | |
255 | + { "#N03", "数詞:十,二十,…,数十" , "十,二十,…,数十", 0, 3 }, | |
256 | + { "#KN", "形式名詞" , "あと/うち/おり/こと/", 0, 3 }, | |
257 | + { "#TKN", "新形式名詞" , "はず/わけ", 0, 2 }, | |
258 | + { "#JTNO", "準体言名詞" , "くらい/ぐらい/こそ", 0, 2 }, | |
259 | + { "#PRE", "接頭語" , "", 0, 3 }, | |
260 | + { "#CNPRE", "接頭語:一般" , "", 0, 3 }, | |
261 | + { "#JNPRE", "接頭語:地名" , "", 0, 2 }, | |
262 | + { "#NNPRE", "接頭語:数詞" , "", 0, 3 }, | |
263 | + { "#SNPRE", "接頭語:サ変名詞" , "", 0, 2 }, | |
264 | + { "#SUN", "接尾語:一般" , "", 0, 2 }, | |
265 | + { "#CNSUC1","接尾語:地名 1" , "", 0, 3 }, | |
266 | + { "#CNSUC2","接尾語:地名 2" , "", 0, 3 }, | |
267 | + { "#JNSUC" ,"接尾語:人名" , "", 0, 3 }, | |
268 | + { "#N2T30", "接尾語:サ変名詞化" , "(名)+化,視", 0, 3 }, | |
269 | + { "#N2T35", "接尾語:名詞化" , "", 0, 3 }, | |
270 | + { "#D2T35", "接尾語:動詞連用形+名詞化" , "(動詞連用形)+っぱなし", 0, 3 }, | |
271 | + { "#D2T16", "接尾語:形容動詞化" , "(動詞連用形)+がち", 0, 3 }, | |
272 | + { "#ND2KY", "接尾語:形容詞化" , "(名,動用)+がましい,強(づよ)い: 押し付けがましい", 0, 3 }, | |
273 | + { "#D2KY", "接尾語:形容詞化(動詞連用形)", "(動連)+しづらい,難(がた)い", 0, 3 }, | |
274 | + { "#N2KYT", "接尾語:形容詞化(名ナノ)" , "(名)+高(だか)い,早(ばや)い: 名高い,手早い", 0, 3 }, | |
275 | + { "#N2T10", "特殊活用:形容動詞化(T10)" , "(名)+づかい", 0, 3 }, | |
276 | + { "#N2T15", "特殊活用:形容動詞化(T15)" , "(名)+ずくめ", 0, 2 }, | |
277 | + { "#N2T16", "特殊活用:形容動詞化(T16)" , "(名)+的,式,風,流", 0, 3 }, | |
278 | + { "#N2T17", "特殊活用:形容動詞化(T17)" , "", 0, 1 }, | |
279 | + { "#N2T18", "特殊活用:形容動詞化(T18)" , "(名)+みたい,がち", 0, 2 }, | |
280 | + { "#JS", "数助詞" , "", 0, 3 }, | |
281 | + { "#JSSUC", "数助詞接尾語" , "", 0, 3 }, | |
282 | + { "#JNMUC", "接尾語:人名(名)" , "", 0, 1 }, | |
283 | + { "#JNMSUC","接尾語:名" , "", 0, 2 }, | |
284 | + { "#JNSSUC","接尾語:姓" , "", 0, 3 }, | |
285 | +}; | |
286 | + | |
287 | +unsigned int nr_substantive_code = sizeof(substantive_code) / sizeof(category_code); | |
288 | +unsigned int nr_adverb_code = sizeof(adverb_code) / sizeof(category_code); | |
289 | +unsigned int nr_verb_code = sizeof(verb_code) / sizeof(category_code); | |
290 | +unsigned int nr_adjective_code = sizeof(adjective_code) / sizeof(category_code); | |
291 | +unsigned int nr_etc_code = sizeof(etc_code) / sizeof(category_code); | |
292 | + | |
293 | +const char *find_desc_from_code(const char *code) | |
294 | +{ | |
295 | + int pos; | |
296 | + const char *cclass_desc = NULL; | |
297 | + | |
298 | + for (pos = 0; pos < NR_POS; pos++) { | |
299 | + cclass_desc = find_desc_from_code_with_type(code, pos); | |
300 | + if (cclass_desc) | |
301 | + break; | |
302 | + } | |
303 | + | |
304 | + return cclass_desc; | |
305 | +} | |
306 | + | |
307 | +/* short cut of find_desc_from_code */ | |
308 | +const char *find_desc_from_code_with_type(const char *code, int type) { | |
309 | + /* need to be more smart */ | |
310 | + int i = 0, j = 0; | |
311 | + char *pos = NULL; | |
312 | + category_code *category[] = { | |
313 | + substantive_code, | |
314 | + verb_code, | |
315 | + adjective_code, | |
316 | + adverb_code, | |
317 | + etc_code, | |
318 | + NULL, | |
319 | + }; | |
320 | + int num[] = { | |
321 | + sizeof(substantive_code) / sizeof(substantive_code[0]), | |
322 | + sizeof(verb_code) / sizeof(verb_code[0]), | |
323 | + sizeof(adjective_code) / sizeof(adjective_code[0]), | |
324 | + sizeof(adverb_code) / sizeof(adverb_code[0]), | |
325 | + sizeof(etc_code) / sizeof(etc_code[0]), | |
326 | + 0, | |
327 | + }; | |
328 | + | |
329 | + do { | |
330 | + for (j = 0; j < num[i]; j++) { | |
331 | + if (strcmp(code, (category[i])[j].code) == 0 | |
332 | + && ((category[i])[j].type & type) == type) | |
333 | + pos = strdup((category[i])[j].desc); | |
334 | + } | |
335 | + i++; | |
336 | + } while (category[i] != NULL); | |
337 | + | |
338 | + return pos; | |
339 | +} | |
340 | + | |
341 | +const char *find_code_from_desc(const char *desc, int type) { | |
342 | + /* need to be more smart */ | |
343 | + int i = 0, j = 0; | |
344 | + char *code = NULL; | |
345 | + category_code *category[] = { | |
346 | + substantive_code, | |
347 | + verb_code, | |
348 | + adjective_code, | |
349 | + adverb_code, | |
350 | + etc_code, | |
351 | + NULL, | |
352 | + }; | |
353 | + int num[] = { | |
354 | + sizeof(substantive_code) / sizeof(substantive_code[0]), | |
355 | + sizeof(verb_code) / sizeof(verb_code[0]), | |
356 | + sizeof(adjective_code) / sizeof(adjective_code[0]), | |
357 | + sizeof(adverb_code) / sizeof(adverb_code[0]), | |
358 | + sizeof(etc_code) / sizeof(etc_code[0]), | |
359 | + 0, | |
360 | + }; | |
361 | + | |
362 | + do { | |
363 | + for (j = 0; j < num[i]; j++) { | |
364 | + if (strcmp(desc, (category[i])[j].desc) == 0 | |
365 | + && ((category[i])[j].type & type) == type) | |
366 | + code = strdup((category[i])[j].code); | |
367 | + } | |
368 | + i++; | |
369 | + } while (category[i] != NULL); | |
370 | + | |
371 | + return code; | |
372 | +} | |
373 | + | |
374 | +int | |
375 | +find_cclass_type_from_code (const char *code) | |
376 | +{ | |
377 | + int pos; | |
378 | + const char *cclass_desc = NULL; | |
379 | + | |
380 | + for (pos = 0; pos < NR_POS; pos++) { | |
381 | + cclass_desc = find_desc_from_code_with_type(code, pos); | |
382 | + if (cclass_desc) | |
383 | + return pos; | |
384 | + } | |
385 | + | |
386 | + return -1; | |
387 | +} | |
388 | + | |
389 | +int | |
390 | +find_cclass_type_from_desc (const char *desc) | |
391 | +{ | |
392 | + int pos; | |
393 | + const char *cclass_code = NULL; | |
394 | + | |
395 | + for (pos = 0; pos < NR_POS; pos++) { | |
396 | + cclass_code = find_code_from_desc(desc, pos); | |
397 | + if (cclass_code) | |
398 | + return pos; | |
399 | + } | |
400 | + | |
401 | + return -1; | |
402 | +} |
@@ -0,0 +1,128 @@ | ||
1 | +/* | |
2 | + * Copyright (c) 2003,2004 Masahito Omote <omote@utyuuzin.net> | |
3 | + * 2005-2006 uim Project http://uim.freedesktop.org/ | |
4 | + * | |
5 | + * All rights reserved. | |
6 | + * | |
7 | + * Redistribution and use in source and binary forms, with or without | |
8 | + * modification, are permitted provided that the following conditions | |
9 | + * are met: | |
10 | + * | |
11 | + * 1. Redistributions of source code must retain the above copyright | |
12 | + * notice, this list of conditions and the following disclaimer. | |
13 | + * 2. Redistributions in binary form must reproduce the above copyright | |
14 | + * notice, this list of conditions and the following disclaimer in the | |
15 | + * documentation and/or other materials provided with the distribution. | |
16 | + * 3. Neither the name of authors nor the names of its contributors | |
17 | + * may be used to endorse or promote products derived from this software | |
18 | + * without specific prior written permission. | |
19 | + * | |
20 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | |
21 | + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE | |
24 | + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | + * SUCH DAMAGE. | |
31 | + * | |
32 | + * This code is based on canna's code. For more information about canna, | |
33 | + * visit http://canna.sourceforge.jp/ . Canna license is as follows, | |
34 | + * | |
35 | + * Copyright (c) 2002 Canna Project. All rights reserved. | |
36 | + * | |
37 | + * Permission to use, copy, modify, distribute and sell this software | |
38 | + * and its documentation for any purpose is hereby granted without | |
39 | + * fee, provided that the above copyright notice appear in all copies | |
40 | + * and that both that copyright notice and this permission notice | |
41 | + * appear in supporting documentation, and that the name of the | |
42 | + * author and contributors not be used in advertising or publicity | |
43 | + * pertaining to distribution of the software without specific, written | |
44 | + * prior permission. The author and contributors no representations | |
45 | + * about the suitability of this software for any purpose. It is | |
46 | + * provided "as is" without express or implied warranty. | |
47 | + * | |
48 | + * THE AUTHOR AND CONTRIBUTORS DISCLAIMS ALL WARRANTIES WITH REGARD TO | |
49 | + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
50 | + * FITNESS, IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR | |
51 | + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER | |
52 | + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF | |
53 | + * CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN | |
54 | + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
55 | + * | |
56 | + * Copyright 1994 NEC Corporation, Tokyo, Japan. | |
57 | + * | |
58 | + * Permission to use, copy, modify, distribute and sell this software | |
59 | + * and its documentation for any purpose is hereby granted without | |
60 | + * fee, provided that the above copyright notice appear in all copies | |
61 | + * and that both that copyright notice and this permission notice | |
62 | + * appear in supporting documentation, and that the name of NEC | |
63 | + * Corporation not be used in advertising or publicity pertaining to | |
64 | + * distribution of the software without specific, written prior | |
65 | + * permission. NEC Corporation makes no representations about the | |
66 | + * suitability of this software for any purpose. It is provided "as | |
67 | + * is" without express or implied warranty. | |
68 | + * | |
69 | + * NEC CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
70 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | |
71 | + * NO EVENT SHALL NEC CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR | |
72 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |
73 | + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | |
74 | + * OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
75 | + * PERFORMANCE OF THIS SOFTWARE. | |
76 | + */ | |
77 | + | |
78 | +#ifndef __dict_canna_cclass_h_included__ | |
79 | +#define __dict_canna_cclass_h_included__ | |
80 | + | |
81 | +#include "dict-word.h" | |
82 | + | |
83 | +#define SUPPORT_ANTHY (1 << 0) | |
84 | +#define SUPPORT_CANNA (1 << 1) | |
85 | +#define SUPPORT_ANTHY_CANNA (SUPPORT_ANTHY|SUPPORT_CANNA) | |
86 | + | |
87 | +enum { | |
88 | + POS_SUBSTANTIVE, | |
89 | + POS_VERB, | |
90 | + POS_ADJECTIVE, | |
91 | + POS_ADVERB, | |
92 | + POS_ETC, | |
93 | + NR_POS | |
94 | +}; | |
95 | + | |
96 | +typedef struct _category_code { | |
97 | + const char *code; | |
98 | + const char *desc; | |
99 | + const char *example; | |
100 | + int flag; | |
101 | + int type; | |
102 | +} category_code; | |
103 | + | |
104 | +extern category_code substantive_code[]; | |
105 | +extern category_code adverb_code[]; | |
106 | +extern category_code verb_code[]; | |
107 | +extern category_code adjective_code[]; | |
108 | +extern category_code etc_code[]; | |
109 | + | |
110 | +extern unsigned int nr_substantive_code; | |
111 | +extern unsigned int nr_adverb_code; | |
112 | +extern unsigned int nr_verb_code; | |
113 | +extern unsigned int nr_adjective_code; | |
114 | +extern unsigned int nr_etc_code; | |
115 | + | |
116 | +#if 0 | |
117 | +void cannadic_parse_line (unsigned char *, word **); | |
118 | +int cannadic_import (const char *, int); | |
119 | +int cannadic_export (const char *, int); | |
120 | +GList *cannadic_parse_line_glist (unsigned char *buf, GList *list); | |
121 | +#endif | |
122 | +const char *find_desc_from_code (const char *code); | |
123 | +const char *find_desc_from_code_with_type (const char *code, int type); | |
124 | +const char *find_code_from_desc (const char *desc, int type); | |
125 | +int find_cclass_type_from_code (const char *code); | |
126 | +int find_cclass_type_from_desc (const char *desc); | |
127 | + | |
128 | +#endif /* __dict_canna_cclass_h_included__ */ |