Interset/Tagset/JA/Ipadic.pm untested

filter: Statementstmt 0.0% 0 / 239 Branchbran 0.0% 0 / 180 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 439 CC 91 SCAR 89.1
CC
91
Cov
0%
encode
8190.0
decode
6.0
get_tagset_id
2.0
CRAP 7371.3
1 # ABSTRACT: Driver for the IPADIC tagset.
2  
3 package Lingua::Interset::Tagset::JA::Ipadic;
4 use strict;
5 use warnings;
6 our $VERSION = '3.014';
7  
8 use utf8;
9 use open ':utf8';
10 use namespace::autoclean;
11 use Moose;
12 extends 'Lingua::Interset::Tagset';
13  
14  
15  
16 #------------------------------------------------------------------------------
17 # Returns the tagset id that should be set as the value of the 'tagset' feature
18 # during decoding. Every derived class must (re)define this method! The result
19 # should correspond to the last two parts in package name, lowercased.
20 # Specifically, it should be the ISO 639-2 language code, followed by '::' and
21 # a language-specific tagset id. Example: 'cs::multext'.
22 #------------------------------------------------------------------------------
23 sub get_tagset_id
24 {
25 return 'ja::ipadic';
26 }
27  
28  
29 ### TODO: find a better way to distinguish bound-verbs (動詞-非自立) and auxiliary verbs (助動詞)
30  
31 # We decided not to divide tags into subcategories (by default they should
32 # be divided by '-')
33 my %postable =
34 (
35  
36 # tag translations taken from http://sourceforge.jp/projects/ipadic/docs/postag.txt/ja/1/postag.txt.txt
37  
38 '名詞' => ['pos' => 'noun'], # noun
39 '名詞-一般' => ['pos' => 'noun', 'nountype' => 'com'], # noun-common
40 '名詞-固有名詞' => ['pos' => 'noun', 'nountype' => 'prop'], # noun-proper
41 '名詞-固有名詞-一般' => ['pos' => 'noun', 'nountype' => 'prop', 'other' => 'misc'], # noun-proper-misc
42 '名詞-固有名詞-人名' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'prs'], # noun-proper-person
43 '名詞-固有名詞-人名-一般' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'prs', 'other' => 'misc'], # noun-proper-person-misc
44 '名詞-固有名詞-人名-姓' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'sur'], # noun-proper-person-surname
45 '名詞-固有名詞-人名-名' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'giv'], # noun-proper-person-given_name
46 '名詞-固有名詞-組織' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'com'], # noun-proper-organization
47 '名詞-固有名詞-地域' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'geo'], # noun-proper-place
48 '名詞-固有名詞-地域-一般' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'geo', 'other' => 'misc'], # noun-proper-place-misc
49 '名詞-固有名詞-地域-国' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'geo', 'other' => 'country'], # noun-proper-place-country
50 '名詞-代名詞' => ['pos' => 'noun', 'prontype' => 'prn'], # noun-pronoun
51 '名詞-代名詞-一般' => ['pos' => 'noun', 'prontype' => 'prn', 'other' => 'misc'], # noun-pronoun-misc
52 '名詞-代名詞-縮約' => ['pos' => 'noun', 'prontype' => 'prn', 'other' => 'postpron'], # noun-pronoun-contraction ?? 'adpostype' => 'postpron' ??
53 '名詞-副詞可能' => ['pos' => 'noun', 'other' => 'adv'], # noun-adverbial
54 '名詞-サ変接続' => ['pos' => 'noun', 'other' => 'verb'], # noun-verbal
55 '名詞-形容動詞語幹' => ['pos' => 'noun', 'other' => 'adj'], # noun-adjective
56 '名詞-数' => ['pos' => 'num'], # noun-numeral
57 '名詞-非自立' => ['pos' => 'noun', 'other' => 'affix'], # noun-affix
58 '名詞-非自立-一般' => ['pos' => 'noun', 'other' => 'affix-misc'], # noun-affix-misc
59 '名詞-非自立-副詞可能' => ['pos' => 'noun', 'other' => 'affix-adv'], # noun-affix-adverbial
60 '名詞-非自立-助動詞語幹' => ['pos' => 'noun', 'other' => 'affix-aux'], # noun-affix-aux
61 '名詞-非自立-形容動詞語幹' => ['pos' => 'noun', 'other' => 'affix-adj'], # noun-affix-adjective
62 '名詞-特殊' => ['pos' => 'noun', 'other' => 'special'], # noun-special
63 '名詞-特殊-助動詞語幹' => ['pos' => 'noun', 'other' => 'special-aux'], # noun-special-aux
64 '名詞-接尾' => ['pos' => 'noun', 'other' => 'suffix'], # noun-suffix
65 '名詞-接尾-一般' => ['pos' => 'noun', 'other' => 'suffix-misc'], # noun-suffix-misc
66 '名詞-接尾-人名' => ['pos' => 'noun', 'other' => 'suffix-prs'], # noun-suffix-person
67 '名詞-接尾-地域' => ['pos' => 'noun', 'other' => 'suffix-place'], # noun-suffix-place
68 '名詞-接尾-サ変接続' => ['pos' => 'noun', 'other' => 'suffix-verb'], # noun-suffix-verbal
69 '名詞-接尾-助動詞語幹' => ['pos' => 'noun', 'other' => 'suffix-aux'], # noun-suffix-aux
70 '名詞-接尾-形容動詞語幹' => ['pos' => 'noun', 'other' => 'suffix-adj'], # noun-suffix-adjective
71 '名詞-接尾-副詞可能' => ['pos' => 'noun', 'other' => 'suffix-adv'], # noun-suffix-adverbal
72 '名詞-接尾-助数詞' => ['pos' => 'noun', 'nountype' => 'class'], # noun-suffix-classifier
73 '名詞-接尾-特殊' => ['pos' => 'noun', 'other' => 'suffix-special'], # noun-suffix-special
74 '名詞-接続詞的' => ['pos' => 'noun', 'other' => 'suffix-conj'], # noun-suffix-conjunctive
75 '名詞-動詞非自立的' => ['pos' => 'noun', 'other' => 'suffix-verb_aux'], # noun-verbal_aux
76 '名詞-引用文字列' => ['pos' => 'noun', 'other' => 'quote'], # noun-quote
77 '名詞-ナイ形容詞語幹' => ['pos' => 'noun', 'other' => 'nai_adj'], # noun-nai_adjective
78 '接頭詞' => ['other' => 'prefix'], # prefix
79 '接頭詞-名詞接続' => ['pos' => 'noun', 'other' => 'prefix'], # prefix-nominal
80 '接頭詞-動詞接続' => ['pos' => 'verb', 'other' => 'prefix'], # prefix-verbal
81 '接頭詞-形容詞接続' => ['pos' => 'adj', 'other' => 'prefix'], # prefix-adjectival
82 '接頭詞-数接続' => ['pos' => 'num', 'other' => 'prefix'], # prefix-numerical
83 '動詞' => ['pos' => 'verb'], # verb
84 '動詞-自立' => ['pos' => 'verb', 'other' => 'main'], # verb-main (independent)
85 '動詞-非自立' => ['pos' => 'verb', 'verbtype' => 'aux', 'other' => 'bound'], # verb-aux (non-independent)
86 '動詞-接尾' => ['pos' => 'verb', 'other' => 'suffix'], # verb-suffix
87 '形容詞' => ['pos' => 'adj'], # adjective
88 '形容詞-自立' => ['pos' => 'adj', 'other' => 'main'], # adjective-main (independent)
89 '形容詞-非自立' => ['pos' => 'adj', 'verbtype' => 'aux', 'other' => 'bound'], # adjective-aux (non-independent)
90 '形容詞-接尾' => ['pos' => 'adj', 'other' => 'suffix'], # adjective-suffix
91 '副詞' => ['pos' => 'adv'], # adverb
92 '副詞-一般' => ['pos' => 'adv', 'other' => 'misc'], # adverb-misc
93 '副詞-助詞類接続' => ['pos' => 'adv', 'other' => 'conj'], # adverb-particle_conjunction
94 '連体詞' => ['pos' => 'adj', 'morphpos' => 'noun'], # adnominal
95 #'連体詞' => ['pos' => 'adj', 'other' => 'adnominal'], # adnominal
96 '接続詞' => ['pos' => 'conj'], # conjunction
97 '助詞' => ['pos' => 'adp', 'adpostype' => 'post'], # particle
98 '助詞-格助詞' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'case'], # particle-case
99 '助詞-格助詞-一般' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'case-misc'], # particle-case-misc
100 '助詞-格助詞-引用' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'quote'], # particle-case-quote
101 '助詞-格助詞-連語' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'compound'], # particle-compound
102 '助詞-接続助詞' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'conj'], # particle-conjunctive
103 '助詞-係助詞' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'dependency'], # particle-dependency
104 '助詞-副助詞' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'adv'], # particle-adverbial
105 '助詞-間投助詞' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'int'], # particle-interjective
106 '助詞-並立助詞' => ['pos' => 'conj', 'adpostype' => 'post', 'conjtype' => 'coor'], # particle-coordinate
107 '助詞-終助詞' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'final'], # particle-final
108 '助詞-副助詞/並立助詞/終助詞' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'adv/conj/final'], # particle-adverbial/conjunctive/final
109 '助詞-連体化' => ['pos' => 'adp', 'adpostype' => 'post', 'case' => 'gen'], # particle-adnominalizer
110 '助詞-副詞化' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'adverbializer'], # particle-adverbializer
111 '助詞-特殊' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => 'special'], # particle-special
112 '助動詞' => ['pos' => 'verb', 'verbtype' => 'aux'], # aux
113 '感動詞' => ['pos' => 'int'], # exclamation
114 '記号' => ['pos' => 'sym'], # symbol
115 '記号-一般' => ['pos' => 'sym', 'other' => 'misc'], # symbol-misc
116 '記号-句点' => ['pos' => 'punc', 'punctype' => 'peri'], # symbol-comma
117 '記号-読点' => ['pos' => 'punc', 'punctype' => 'comm'], # symbol-period
118 '記号-空白' => ['pos' => 'punc', 'other' => 'space'], # symbol-space
119 '記号-アルファベット' => ['pos' => 'sym', 'other' => 'alphabet'], # symbol-alphabetic
120 '記号-括弧開' => ['pos' => 'punc', 'punctype' => 'brck', 'puncside' => 'ini'], # symbol-left_parenthesis
121 '記号-括弧閉' => ['pos' => 'punc', 'punctype' => 'brck', 'puncside' => 'fin'], # symbol-right_parenthesis
122 'その他' => ['other' => 'other'], # other
123 'その他-間投' => ['pos' => 'int', 'other' => 'other'], # other-interjection
124 'フィラー' => ['other' => 'filler'], # filler
125 '非言語音' => ['other' => 'sound'], # nonlinguistic_sound
126 '語断片' => ['other' => 'fragment'], # fragment
127 );
128  
129  
130  
131 #------------------------------------------------------------------------------
132 # Decodes a physical tag (string) and returns the corresponding feature
133 # structure.
134 #------------------------------------------------------------------------------
135 sub decode
136 {
137 my $self = shift;
138 my $tag = shift;
139  
140 my $fs = Lingua::Interset::FeatureStructure->new();
141 $fs->set_tagset('ja::ipadic');
142  
143 $tag =~ s/\n//; # user should be taking care of this
144 my $assignments = $postable{$tag};
145 $fs->add(@{$assignments}) if $assignments;
146  
147 return $fs;
148 }
149  
150  
151  
152 #------------------------------------------------------------------------------
153 # Takes feature structure and returns the corresponding physical tag (string).
154 #------------------------------------------------------------------------------
155 sub encode
156 {
157 my $self = shift;
158 my $fs = shift; # Lingua::Interset::FeatureStructure
159 my $tag = '';
160  
161 my $pos = $fs->pos();
162  
163 # Prefixes
164 if ($fs->other() eq 'prefix')
165 {
166 if ($pos)
167 {
168 # prefix-nominal
169 if ($pos eq 'noun')
170 {
171 $tag = '接頭詞-名詞接続';
172 }
173 # prefix-vebal
174 elsif ($pos eq 'verb')
175 {
176 $tag = '接頭詞-動詞接続';
177 }
178 # prefix-adjectival
179 elsif ($pos eq 'adj')
180 {
181 $tag = '接頭詞-形容詞接続';
182 }
183 # prefix-numeral
184 elsif ($pos eq 'num')
185 {
186 $tag = '接頭詞-数接続';
187 }
188 }
189 # prefix
190 else
191 {
192 $tag = '接頭詞';
193 }
194 }
195  
196 # Nouns
197 elsif ($pos eq 'noun')
198 {
199 if ($fs->nountype())
200 {
201 # noun-common
202 if ($fs->nountype() eq 'com')
203 {
204 $tag = '名詞-一般';
205 }
206 # noun-suffix-classifier
207 elsif ($fs->nountype() eq 'class')
208 {
209 $tag = '名詞-接尾-助数詞';
210 }
211  
212 # Proper nouns
213 else
214 {
215 # noun-proper-person-misc noun-proper-person
216 if ($fs->nametype() eq 'prs')
217 {
218 if ($fs->other() eq 'misc')
219 {
220 $tag = '名詞-固有名詞-人名-一般';
221 }
222 else
223 {
224 $tag = '名詞-固有名詞-人名';
225 }
226 }
227 # noun-proper-person-surname
228 elsif ($fs->nametype() eq 'sur')
229 {
230 $tag = '名詞-固有名詞-人名-姓';
231 }
232 # noun-proper-person-given_name
233 elsif ($fs->nametype() eq 'giv')
234 {
235 $tag = '名詞-固有名詞-人名-名';
236 }
237 # noun-proper-organization
238 elsif ($fs->nametype() eq 'com')
239 {
240 $tag = '名詞-固有名詞-組織';
241 }
242 # noun-proper-place-misc noun-proper-place-country noun-proper-place
243 elsif ($fs->nametype() eq 'geo')
244 {
245 if ($fs->other() eq 'country')
246 {
247 $tag = '名詞-固有名詞-地域-国';
248 }
249 elsif ($fs->other() eq 'misc')
250 {
251 $tag = '名詞-固有名詞-地域-一般';
252 }
253 else
254 {
255 $tag = '名詞-固有名詞-地域';
256 }
257 }
258 # noun-proper-misc
259 elsif ($fs->other() eq 'misc')
260 {
261 $tag = '名詞-固有名詞-一般';
262 }
263 # noun-proper
264 else
265 {
266 $tag = '名詞-固有名詞';
267 }
268 }
269 }
270  
271 # noun-pronoun-contraction noun-pronoun-misc noun-pronoun
272 elsif ($fs->prontype())
273 {
274 if ($fs->other eq 'postpron')
275 {
276 $tag = '名詞-代名詞-縮約';
277 }
278 elsif ($fs->other() eq 'misc')
279 {
280 $tag = '名詞-代名詞-一般';
281 }
282 else
283 {
284 $tag = '名詞-代名詞';
285 }
286 }
287  
288 # noun-adverbial
289 elsif ($fs->other() eq 'adv')
290 {
291 $tag = '名詞-副詞可能';
292 }
293  
294 # noun-verbal
295 elsif ($fs->other() eq 'verb')
296 {
297 $tag = '名詞-サ変接続';
298 }
299  
300 # noun-adjective
301 elsif ($fs->other() eq 'adj')
302 {
303 $tag = '名詞-形容動詞語幹';
304 }
305  
306 # Affixes
307 elsif ($fs->other() =~ /affix/)
308 {
309 # noun-affix-adverbial
310 if ($fs->other() =~ /-adv$/)
311 {
312 $tag = '名詞-非自立-副詞可能';
313 }
314 # noun-affix-aux
315 elsif ($fs->other() =~ /-aux$/)
316 {
317 $tag = '名詞-非自立-助動詞語幹';
318 }
319 # noun-affix-adjective
320 elsif ($fs->other() =~ /-adj$/)
321 {
322 $tag = '名詞-非自立-形容動詞語幹';
323 }
324 # noun-affix-misc
325 elsif ($fs->other() =~ /-misc$/)
326 {
327 $tag = '名詞-非自立-一般';
328 }
329 # noun-affix
330 else
331 {
332 $tag = '名詞-非自立';
333 }
334 }
335  
336 # Suffixes
337 elsif ($fs->other() =~ /suffix/)
338 {
339 # noun-suffix-person
340 if ($fs->other() =~ /-prs$/)
341 {
342 $tag = '名詞-接尾-人名';
343 }
344 # noun-suffix-place
345 elsif ($fs->other() =~ /-place$/)
346 {
347 $tag = '名詞-接尾-地域';
348 }
349 # noun-suffix-verbal
350 elsif ($fs->other() =~ /-verb$/)
351 {
352 $tag = '名詞-接尾-サ変接続';
353 }
354 # noun-suffix-aux
355 elsif ($fs->other() =~ /-aux$/)
356 {
357 $tag = '名詞-接尾-助動詞語幹';
358 }
359 # noun-suffix-adjective
360 elsif ($fs->other() =~ /-adj$/)
361 {
362 $tag = '名詞-接尾-形容動詞語幹';
363 }
364 # noun-suffix-adverbal
365 elsif ($fs->other() =~ /-adv$/)
366 {
367 $tag = '名詞-接尾-副詞可能';
368 }
369 # noun-suffix-special
370 elsif ($fs->other() =~ /-special$/)
371 {
372 $tag = '名詞-接尾-特殊';
373 }
374 # noun-suffix-conjunctive
375 elsif ($fs->other() =~ /-conj$/)
376 {
377 $tag = '名詞-接続詞的';
378 }
379 # noun-suffix-verbal_aux
380 elsif ($fs->other() =~ /-verb_aux$/)
381 {
382 $tag = '名詞-動詞非自立的';
383 }
384 # noun-suffix-misc
385 elsif ($fs->other() =~ /-misc$/)
386 {
387 $tag = '名詞-接尾-一般';
388 }
389 # noun-suffix
390 else
391 {
392 $tag = '名詞-接尾';
393 }
394 }
395  
396 # noun-suffix-classifier
397 elsif ($fs->nountype() eq 'class')
398 {
399 $tag = '名詞-接尾-助数詞';
400 }
401  
402 # noun-special
403 elsif ($fs->other() eq 'special')
404 {
405 $tag = '名詞-特殊';
406 }
407  
408 # noun-special-aux
409 elsif ($fs->other() eq 'special-aux')
410 {
411 $tag = '名詞-特殊-助動詞語幹';
412 }
413  
414 # noun-quote
415 elsif ($fs->other() eq 'quote')
416 {
417 $tag = '名詞-引用文字列';
418 }
419  
420 # noun-nai_adjective
421 elsif ($fs->other() eq 'nai_adj')
422 {
423 $tag = '名詞-ナイ形容詞語幹';
424 }
425  
426 # noun
427 else
428 {
429 $tag = '名詞';
430 }
431 }
432  
433 # noun-numeral
434 elsif ($pos eq 'num')
435 {
436 $tag = '名詞-数';
437 }
438  
439 # Verbs
440 elsif ($pos eq 'verb')
441 {
442 # verb-aux
443 if ($fs->verbtype() eq 'aux' && $fs->other() eq 'bound')
444 {
445 $tag = '動詞-非自立';
446 }
447 # verb-suffix
448 elsif ($fs->other() eq 'suffix')
449 {
450 $tag = '動詞-接尾';
451 }
452 # aux
453 elsif ($fs->verbtype() eq 'aux')
454 {
455 $tag = '助動詞';
456 }
457 # verb-main
458 elsif ($fs->other() eq 'main')
459 {
460 $tag = '動詞-自立';
461 }
462 # verb
463 else
464 {
465 $tag = '動詞';
466 }
467 }
468  
469 # Adjectives
470 elsif ($pos eq 'adj')
471 {
472 # adjective-aux
473 if ($fs->verbtype() eq 'aux')
474 {
475 $tag = '形容詞-非自立';
476 }
477 # adjective-suffix
478 elsif ($fs->other() eq 'suffix')
479 {
480 $tag = '形容詞-接尾';
481 }
482 # adjective-adnominal
483 elsif ($fs->morphpos() eq 'noun')
484 #elsif ($fs->other() eq 'adnominal')
485 {
486 $tag = '連体詞';
487 }
488 # adjective-main
489 elsif ($fs->other() eq 'main')
490 {
491 $tag = '形容詞-自立';
492 }
493 # adjective
494 else
495 {
496 $tag = '形容詞';
497 }
498 }
499  
500 # Adverbs
501 elsif ($pos eq 'adv')
502 {
503 # adverb-particle_conjunction
504 if ($fs->other() eq 'conj')
505 {
506 $tag = '副詞-助詞類接続';
507 }
508 # adverb-misc
509 elsif ($fs->other() eq 'misc')
510 {
511 $tag = '副詞-一般';
512 }
513 # adverb
514 else
515 {
516 $tag = '副詞';
517 }
518 }
519  
520 # particle-coordinate conjunction
521 elsif ($pos eq 'conj')
522 {
523 if ($fs->adpostype())
524 {
525 $tag = '助詞-並立助詞';
526 }
527 else
528 {
529 $tag = '接続詞';
530 }
531 }
532  
533 # Particles (postpositions)
534 elsif ($pos eq 'adp' && $fs->adpostype() eq 'post')
535 {
536 # particle-case-misc particle-case
537 if ($fs->other() =~ /case/)
538 {
539 if ($fs->other() =~ /misc/)
540 {
541 $tag = '助詞-格助詞-一般';
542 }
543 else
544 {
545 $tag = '助詞-格助詞';
546 }
547 }
548 # particle-case-quote
549 elsif ($fs->other() eq 'quote')
550 {
551 $tag = '助詞-格助詞-引用';
552 }
553 # particle-compound
554 elsif ($fs->other() eq 'compound')
555 {
556 $tag = '助詞-格助詞-連語';
557 }
558 # particle-conjunctive
559 elsif ($fs->other() eq 'conj')
560 {
561 $tag = '助詞-接続助詞';
562 }
563 # particle-dependency
564 elsif ($fs->other() eq 'dependency')
565 {
566 $tag = '助詞-係助詞';
567 }
568 # particle-adverbial
569 elsif ($fs->other() eq 'adv')
570 {
571 $tag = '助詞-副助詞';
572 }
573 # particle-interjective
574 elsif ($fs->other() eq 'int')
575 {
576 $tag = '助詞-間投助詞';
577 }
578 # particle-final
579 elsif ($fs->other() eq 'final')
580 {
581 $tag = '助詞-終助詞';
582 }
583 # particle-adverbial/conjunctive/final
584 elsif ($fs->other() eq 'adv/conj/final')
585 {
586 $tag = '助詞-副助詞/並立助詞/終助詞';
587 }
588 # particle-adnominalizer
589 elsif ($fs->case() eq 'gen')
590 {
591 $tag = '助詞-連体化';
592 }
593 # particle-adverbializer
594 elsif ($fs->other() eq 'adverbializer')
595 {
596 $tag = '助詞-副詞化';
597 }
598 # particle-special
599 elsif ($fs->other() eq 'special')
600 {
601 $tag = '助詞-特殊';
602 }
603 # particle
604 else
605 {
606 $tag = '助詞';
607 }
608 }
609  
610 # Punctuation and symbols
611 elsif ($pos eq 'sym')
612 {
613 if ($fs->other() eq 'alphabet')
614 {
615 $tag = '記号-アルファベット';
616 }
617 elsif ($fs->other() eq 'misc')
618 {
619 $tag = '記号-一般';
620 }
621 else
622 {
623 $tag = '記号';
624 }
625 }
626 elsif ($pos eq 'punc')
627 {
628 # symbol-left_parenthesis symbol-right_parenthesis
629 if ($fs->punctype() eq 'brck')
630 {
631 if ($fs->puncside() eq 'ini')
632 {
633 $tag = '記号-括弧開';
634 }
635 else
636 {
637 $tag = '記号-括弧閉' ;
638 }
639 }
640 # symbol-comma
641 elsif ($fs->punctype() eq 'peri')
642 {
643 $tag = '記号-句点';
644 }
645 # symbol-period
646 elsif ($fs->punctype() eq 'comm')
647 {
648 $tag = '記号-読点';
649 }
650 # symbol-space
651 else
652 {
653 $tag = '記号-空白';
654 }
655  
656 }
657  
658 # Special categories
659 # filler
660 elsif ($fs->other() eq 'filler')
661 {
662 $tag = 'フィラー';
663 }
664 # nonlinguistic_sound
665 elsif ($fs->other() eq 'sound')
666 {
667 $tag = '非言語音';
668 }
669 # fragment
670 elsif ($fs->other() eq 'fragment')
671 {
672 $tag = '語断片';
673 }
674  
675 # Other
676 else
677 {
678 # other-interjection other
679 if ($fs->pos() eq 'int')
680 {
681 if ($fs->other() eq 'other')
682 {
683 $tag = 'その他-間投';
684 }
685 else
686 {
687 $tag = '感動詞';
688 }
689 }
690 else
691 {
692 $tag = 'その他';
693 }
694 }
695  
696 return $tag;
697 }
698  
699  
700  
701 #------------------------------------------------------------------------------
702 # Returns reference to list of known tags.
703 #------------------------------------------------------------------------------
704 sub list
705 {
706 my $self = shift;
707 my @list = sort(keys(%postable));
708 return \@list;
709 }
710  
711  
712  
713 1;
714  
715 __END__
716  
717 =pod
718  
719 =encoding UTF-8
720  
721 =head1 NAME
722  
723 Lingua::Interset::Tagset::JA::Ipadic - Driver for the IPADIC tagset.
724  
725 =head1 VERSION
726  
727 version 3.014
728  
729 =head1 SYNOPSIS
730  
731 use Lingua::Interset::Tagset::JA::Ipadic;
732 my $driver = Lingua::Interset::Tagset::JA::Ipadic->new();
733 my $fs = $driver->decode('名詞-代名詞');
734  
735 or
736  
737 use Lingua::Interset qw(decode);
738 my $fs = decode('ja::ipadic', '名詞-代名詞');
739  
740 =head1 DESCRIPTION
741  
742 Interset driver for the IPADIC part-of-speech tagset.
743 Tag translations were taken from http://sourceforge.jp/projects/ipadic/docs/postag.txt/ja/1/postag.txt.txt
744  
745 For more information about IPADIC tagset, see Yasuhiro Kawata - Towards a reference tagset for Japanese.
746  
747 =head1 SEE ALSO
748  
749 L<Lingua::Interset>
750 L<Lingua::Interset::Tagset>,
751 L<Lingua::Interset::FeatureStructure>
752  
753 =head1 AUTHOR
754  
755 Dušan Variš <dvaris@seznam.cz>
756  
757 =head1 AUTHOR
758  
759 Dan Zeman <zeman@ufal.mff.cuni.cz>
760  
761 =head1 COPYRIGHT AND LICENSE
762  
763 This software is copyright (c) 2019 by Univerzita Karlova (Charles University).
764  
765 This is free software; you can redistribute it and/or modify it under
766 the same terms as the Perl 5 programming language system itself.
767  
768 =cut