1Text::Kakasi::JP(3) User Contributed Perl Documentation Text::Kakasi::JP(3)
2
3
4
6 Text::Kakasi::JP - Text::Kakasi ÆüËܸì¥É¥¥å¥á¥ó¥È
7
9 use Text::Kakasi;
10 # functional
11 $res = Text::Kakasi::getopt_argv('kakasi', '-ieuc', '-w');
12 $str = Text::Kakasi::do_kakasi($japanese_text);
13 # object-oriented
14 $obj = Text::Kakasi->new('-ieuc','-w');
15 $str = $obj->get($japanese_text);
16
18 Ëܥ⥸¥å¡¼¥ë¤Ïkakasi (kanji kana simple inverter)¤Ø¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹
19 ¤òÄ󶡤·¤Þ¤¹¡£kakasi¤¬Ä󶡤¹¤ë¤Î¤Ï¡¢input method¤ÈµÕ¡¢¤¹¤Ê¤ï¤Á¤«¤Ê´Á»ú
20 ¤Þ¤¸¤êʸ¤ò¤Ò¤é¤¬¤Ê¡¢¥«¥¿¥«¥Ê¡¢¥í¡¼¥Þ»ú¤Ê¤É¤ËµÕÊÑ´¹¤¹¤ëµ¡Ç½¤Ç¤¹¡£kakasi
21 ¤Ï¤Þ¤¿Ê¸½ñ¤Îʬ¤«¤Á½ñ¤¤Ë¤âÍøÍѤ¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¾Ü¤·¤¯¤Ï
22 <http://kakasi.namazu.org/> ¤ò¸æÍ÷²¼¤µ¤¤¡£
23
24 Text::Kakasi ¤Ï¡¢ÅÁÅýŪ¤Ê´Ø¿ô¥Ù¡¼¥¹¤ª¤è¤Ó¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¤ÎÁÐÊý¤Î¥¤¥ó
25 ¥¿¡¼¥Õ¥§¥¤¥¹¤òÄ󶡤·¤Þ¤¹¡£´Ø¿ô¥Ù¡¼¥¹¤ÎÊý¤Ï ver. 1.05 ¤È 100% ¸ß´¹¤Ç¤¹
26 ¤¬¡¢Perl 5.8 °Ê¹ß¤Î¿·µ¡Ç½¤ò»È¤¦¤Ë¤Ï¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤ò
27 »È¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
28
30 Ãí°Õ:°Ê²¼¤ÎÀâÌÀ¤Ç¤Ï "Text::Kakasi::" ¤Ï¾Êά¤·¤Æ¤¤¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï
31 Text::Kakasi ¤Ï²¿¤â export ¤·¤Þ¤»¤ó¡£°Ê²¼¤Î´Ø¿ô¤ò import ¤¹¤ë¤Ë¤Ï¡¢Îã
32 ¤¨¤Ð°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
33
34 use Text::Kakasi qw/getopt_argv do_kakasi/;
35
36 $err = getopt_argv($arg1, $arg2, ...)
37 kakasi¤ò½é´ü²½¤·¤Þ¤¹¡£°ú¿ô¤Ïkakasi¤Î¥ª¥×¥·¥ç¥ó¤ÈƱÅù¤Ç¤¹¡£°Ê²¼¤Ï
38 kakasi 2.3.4 ¤Ë¤ª¤±¤ë¥ª¥×¥·¥ç¥ó¤Î³µÍפǤ¹¡£
39
40 -a[jE] -j[aE] -g[ajE] -k[ajKH]
41 -E[aj] -K[ajkH] -H[ajkK] -J[ajkKH]
42 -i{oldjis,newjis,dec,euc,sjis}
43 -o{oldjis,newjis,dec,euc,sjis}
44 -r{hepburn,kunrei} -p -s -f -c"chars"
45 [jisyo1, jisyo2,,,]
46
47 Character Sets:
48 a: ascii j: jisroman g: graphic k: kana
49 (j,k defined in jisx0201)
50 E: kigou K: katakana H: hiragana J: kanji
51 (E,K,H,J defined in jisx0208)
52
53 Options:
54 -i: input coding system -o: output coding system
55 -r: romaji conversion system
56 -p: list all readings (with -J option)
57 -s: insert separate characters (with -J option)
58 -f: furigana mode (with -J option)
59 -c: skip chars within jukugo
60 (with -J option: default TAB CR LF BLANK)
61 -C: romaji Capitalize (with -Ja or -Jj option)
62 -U: romaji Upcase (with -Ja or -Jj option)
63 -u: call fflush() after 1 character output
64 -w: wakatigaki mode
65
66 ËÜ´Ø¿ô¤Ï¡¢À®¸ù»þ¤Ë0¤ò¡¢¼ºÇÔ»þ¤Ë¤Ï¤½¤ì°Ê³°¤ÎÃͤòÊÖ¤·¤Þ¤¹¡£
67
68 $processed_str = do_kakasi($str)
69 $str¤ËÂФ·¤Ækakasi¤ò¼Â¹Ô¤·¡¢·ë²Ì¤òÊÖ¤·¤Þ¤¹¡£²¿¤é¤«¤ÎÌäÂ꤬ȯÀ¸¤·¤¿
70 ¾ì¹ç¡¢"undef"¤òÊÖ¤·¤Þ¤¹¡£
71
72 Ver. 1.x
73 ¤È°Û¤Ê¤ê¡¢°ú¿ô¤ÎºÇ½é¤Ë"kakasi"¤ò¤Ä¤±¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£¤â¤Á
74 ¤í¤óº£¤Þ¤Ç¤É¤ª¤ê¤Ä¤±¤Æ¤â¹½¤¤¤Þ¤»¤ó¡£
75
76 close_kanwadic()
77 °Å¼¨Åª¤Ëopen¤µ¤ì¤¿¼½ñ¥Õ¥¡¥¤¥ë¤òclose¤·¤Þ¤¹¡£ËÜ´Ø¿ô¤Ï²áµî¤Î¸ß´¹À¤Î¤ß
78 ¤Î¤¿¤á¤Ë¸ºß¤·¡¢¸½ºß¤Ç¤ÏÍøÍѤ¹¤ëɬÍפϤޤº¤Ê¤¤¤Ç¤·¤ç¤¦¡£
79
81 Version 2.0
82 ¤è¤ê¡¢Ëܥ⥸¥å¡¼¥ë¤Ï¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ(OOP)¤ÎAPI¤âÄ󶡤·¤Þ¤¹¡£
83
84 $k = Text::Kakasi->new($args ...)
85 ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Þ¤¹¡£°ú¿ô¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï¡¢
86 "Text::Kakasi->new->set($args ...)" ¤·¤¿¤Î¤ÈƱ¤¸·ë²Ì¤È¤Ê¤ê¤Þ¤¹¡£
87
88 $k->set($args ...)
89 "getopt_argv" ¤Ø¤ÎOOP¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¡£
90
91 my $k = Text::Kakasi->new;
92 $k->set('-w'); # Text::Kakasi::getopt_argv('-w');
93
94 ¥¹¥Æ¡¼¥¿¥¹¤òÊÖ¤¹ "getopt_argv()" ¤È¤Ï°Û¤Ê¤ê¡¢ "set"
95 ¤Ï¾ï¤Ë¥ª¥Ö¥¸¥§¥¯ ¥È¼«¿È¤òÊÖ¤¹¤Î¤Ç¡¢°Ê²¼¤Î¤è¤¦¤Êɽµ¤¬²Äǽ¤Ç¤¹¡£
96
97 my $tokenized = $k->set('-w')->get($raw_japanese);
98
99 ¥¹¥Æ¡¼¥¿¥¹¤¬Íߤ·¤¤¾ì¹ç¤Ë¤Ï¡¢ "$k->error" ¤ò»È¤¤¤Þ¤¹¡£
100
101 $k->error
102 ºÇ¸å¤Ë¸Æ¤Ð¤ì¤¿¥á¥½¥Ã¥É¤Î¥¹¥Æ¡¼¥¿¥¹¤òÊÖ¤·¤Þ¤¹¡£
103
104 $processed = $k->get($raw_japanese);
105 "do_kakasi" ¤Ø¤ÎOOP¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¡£°Ê²¼¤ÎÆó¤Ä¤Î¥³¡¼¥É¤ÏÅù²Á¤Ç¤¹¡£
106
107 # Functional
108 getopt_argv('-w'); $processed = do_kakasi($raw_japanese);
109 # OOP
110 $k->set('-w')->get($raw_japanese);
111
113 Perl 5.8 ¤Ç¡¢Ê¸»ú¥³¡¼¥ÉÊÑ´¹¤Îɸ½àŪ¤ÊÏÈÁȤߤ¬Encode¥â¥¸¥å¡¼¥ë¤Ë¤è¤Ã
114 ¤ÆÄ󶡤µ¤ì¤Þ¤·¤¿¡£Ëܥ⥸¥å¡¼¥ë¤Ï perl 5.8 °Ê¹ß¤Ë¤Æ¤³¤Îµ¡Ç½¤òÍøÍѤ¹¤ë¤è
115 ¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
116
117 "$k->set($args ...)"¤Ø¤Î°ú¿ô¤Ë¡¢"-iencoding" ¤ª¤è¤Ó
118 "-oencoding"¡¡¤¬´Þ¤Þ¤ì¤ë¾ì¹ç¡¢Ê¸»ú¥³¡¼¥ÉÊÑ´¹¤ÏEncode¤¬¹Ô¤¤¤Þ¤¹¡£
119 °ú¿ô¤Ë¤Ïkakasi¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤â¤Î°Ê³°¤Ë¤â¡¢Encode¤¬¥µ¥Ý¡¼¥È¤·¤Æ
120 ¤¤¤ë¤â¤Î¤ÏÁ´¤Æ»È¤¨¤Þ¤¹¡£ Î㤨¤Ð¡¢
121
122 $result = $k->set(qw/-iutf8 -outf8 -w/)->get($utf8);
123
124 ¤Ï°Ê²¼¤È¤Û¤ÜƱµÁ¤Ç¤¹¡£
125
126 $euc = encode('eucjp' => $utf8);
127 getopt_argv('-w');
128 $tmp = do_kakasi($euc);
129 $result = decode('eucjp' => $tmp);
130
131 "-outf8",¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ "$k->get" ¤Ïutf8¥Õ¥é¥°ÉÕ¤¤Îʸ»ú
132 Îó¤òÊÖ¤·¤Þ¤¹¡£
133
134 ¤³¤ì¤é¤Îµ¡Ç½¤Ï¡¢ $Text::Kakasi::HAS_ENCODE¤Ë0¤òÀßÄꤹ¤ë¤³¤È¤ÇÍøÍѤ·
135 ¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£Ä̾ïÊÑ¿ô¤Ï¡¢Ëܥ⥸¥å¡¼¥ë¤òuse¤·¤¿ºÝ¤Ë¼«
136 ưŪ¤ËÀßÄꤵ¤ì¤Þ¤¹¡£
137
139 kakasi(1), <http://kakasi.namazu.org/>,Encode,perlunicode
140
142 (C) 1998, 1999, 2000 NOKUBI Takatsugu <knok@daionet.gr.jp>
143 (C) 2003 Dan Kogai <dankogai@dan.co.jp>
144
145 There is no warranty for this free software. Anyone can modify and/or
146 redistribute this module under GNU GENERAL PUBLIC LICENSE. See COPYING
147 file that is included in the archive for more details.
148
150 Hey! The above document had some coding errors, which are explained
151 below:
152
153 Around line 7:
154 Non-ASCII character seen before =encoding in 'ÆüËܸì¥É¥¥å¥á¥ó¥È'.
155 Assuming CP1252
156
157
158
159perl v5.34.0 2021-07-23 Text::Kakasi::JP(3)