Text::Kakasi::JP(3)

NAME
Text::Kakasi::JP - Text::Kakasi ÆüËÜ¸ì¥É¥¥å¥á¥ó¥È

SYNOPSIS
  use Text::Kakasi;
  # functional
  $res = Text::Kakasi::getopt_argv('kakasi', '-ieuc', '-w');
  $str = Text::Kakasi::do_kakasi($japanese_text);
  # object-oriented
  $obj = Text::Kakasi->new('-ieuc','-w');
  $str = $obj->get($japanese_text);

DESCRIPTION
ËÜ¥â¥¸¥å¡¼¥ë¤Ïkakasi (kanji kana simple inverter)¤Ø¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹ ¤òÄó¶¡¤·¤Þ¤¹¡£kakasi¤¬Äó¶¡¤¹¤ë¤Î¤Ï¡¢input method¤ÈµÕ¡¢¤¹¤Ê¤ï¤Á¤«¤Ê´Á»ú ¤Þ¤¸¤êÊ¸¤ò¤Ò¤é¤¬¤Ê¡¢¥«¥¿¥«¥Ê¡¢¥í¡¼¥Þ»ú¤Ê¤É¤ËµÕÊÑ´¹¤¹¤ëµ¡Ç½¤Ç¤¹¡£kakasi ¤Ï¤Þ¤¿Ê¸½ñ¤ÎÊ¬¤«¤Á½ñ¤¤Ë¤âÍøÍÑ¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¾Ü¤·¤¯¤Ï <http://kakasi.namazu.org/> ¤ò¸æÍ÷²¼¤µ¤¤¡£

Text::Kakasi ¤Ï¡¢ÅÁÅýÅª¤Ê´Ø¿ô¥Ù¡¼¥¹¤ª¤è¤Ó¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¤ÎÁÐÊý¤Î¥¤¥ó ¥¿¡¼¥Õ¥§¥¤¥¹¤òÄó¶¡¤·¤Þ¤¹¡£´Ø¿ô¥Ù¡¼¥¹¤ÎÊý¤Ï ver. 1.05 ¤È 100% ¸ß´¹¤Ç¤¹ ¤¬¡¢Perl 5.8 °Ê¹ß¤Î¿·µ¡Ç½¤ò»È¤¦¤Ë¤Ï¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤ò »È¤¦É¬Í×¤¬¤¢¤ê¤Þ¤¹¡£

Functional APIs
Ãí°Õ:°Ê²¼¤ÎÀâÌÀ¤Ç¤Ï "Text::Kakasi::" ¤Ï¾ÊÎ¬¤·¤Æ¤¤¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï Text::Kakasi ¤Ï²¿¤â export ¤·¤Þ¤»¤ó¡£°Ê²¼¤Î´Ø¿ô¤ò import ¤¹¤ë¤Ë¤Ï¡¢Îã ¤¨¤Ð°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£

  use Text::Kakasi qw/getopt_argv do_kakasi/;

$err = getopt_argv($arg1, $arg2, ...)
    kakasi¤ò½é´ü²½¤·¤Þ¤¹¡£°ú¿ô¤Ïkakasi¤Î¥ª¥×¥·¥ç¥ó¤ÈÆ±Åù¤Ç¤¹¡£°Ê²¼¤Ï kakasi 2.3.4 ¤Ë¤ª¤±¤ë¥ª¥×¥·¥ç¥ó¤Î³µÍ×¤Ç¤¹¡£

      -a[jE] -j[aE] -g[ajE] -k[ajKH]
      -E[aj] -K[ajkH] -H[ajkK] -J[ajkKH]
      -i{oldjis,newjis,dec,euc,sjis}
       -o{oldjis,newjis,dec,euc,sjis}
      -r{hepburn,kunrei} -p -s -f -c"chars"
       [jisyo1, jisyo2,,,]

      Character Sets:
           a: ascii  j: jisroman  g: graphic  k: kana
           (j,k     defined in jisx0201)
           E: kigou  K: katakana  H: hiragana J: kanji
           (E,K,H,J defined in jisx0208)

      Options:
        -i: input coding system    -o: output coding system
        -r: romaji conversion system
        -p: list all readings (with -J option)
        -s: insert separate characters (with -J option)
        -f: furigana mode (with -J option)
        -c: skip chars within jukugo
            (with -J option: default TAB CR LF BLANK)
        -C: romaji Capitalize (with -Ja or -Jj option)
        -U: romaji Upcase     (with -Ja or -Jj option)
        -u: call fflush() after 1 character output
        -w: wakatigaki mode

    ËÜ´Ø¿ô¤Ï¡¢À®¸ù»þ¤Ë0¤ò¡¢¼ºÇÔ»þ¤Ë¤Ï¤½¤ì°Ê³°¤ÎÃÍ¤òÊÖ¤·¤Þ¤¹¡£

$processed_str = do_kakasi($str)
    $str¤ËÂÐ¤·¤Ækakasi¤ò¼Â¹Ô¤·¡¢·ë²Ì¤òÊÖ¤·¤Þ¤¹¡£²¿¤é¤«¤ÎÌäÂê¤¬È¯À¸¤·¤¿ ¾ì¹ç¡¢"undef"¤òÊÖ¤·¤Þ¤¹¡£

    Ver. 1.x ¤È°Û¤Ê¤ê¡¢°ú¿ô¤ÎºÇ½é¤Ë"kakasi"¤ò¤Ä¤±¤ëÉ¬Í×¤Ï¤¢¤ê¤Þ¤»¤ó¡£¤â¤Á ¤í¤óº£¤Þ¤Ç¤É¤ª¤ê¤Ä¤±¤Æ¤â¹½¤¤¤Þ¤»¤ó¡£

close_kanwadic()
    °Å¼¨Åª¤Ëopen¤µ¤ì¤¿¼½ñ¥Õ¥¡¥¤¥ë¤òclose¤·¤Þ¤¹¡£ËÜ´Ø¿ô¤Ï²áµî¤Î¸ß´¹À¤Î¤ß ¤Î¤¿¤á¤ËÂ¸ºß¤·¡¢¸½ºß¤Ç¤ÏÍøÍÑ¤¹¤ëÉ¬Í×¤Ï¤Þ¤º¤Ê¤¤¤Ç¤·¤ç¤¦¡£

Object-Oriented APIs
Version 2.0 ¤è¤ê¡¢ËÜ¥â¥¸¥å¡¼¥ë¤Ï¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ(OOP)¤ÎAPI¤âÄó¶¡¤·¤Þ¤¹¡£

$k = Text::Kakasi->new($args ...)
    ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Þ¤¹¡£°ú¿ô¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï¡¢ "Text::Kakasi->new->set($args ...)" ¤·¤¿¤Î¤ÈÆ±¤¸·ë²Ì¤È¤Ê¤ê¤Þ¤¹¡£

$k->set($args ...)
    "getopt_argv" ¤Ø¤ÎOOP¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¡£

      my $k = Text::Kakasi->new;
      $k->set('-w'); # Text::Kakasi::getopt_argv('-w');

    ¥¹¥Æ¡¼¥¿¥¹¤òÊÖ¤¹ getopt_argv() ¤È¤Ï°Û¤Ê¤ê¡¢ "set" ¤Ï¾ï¤Ë¥ª¥Ö¥¸¥§¥¯ ¥È¼«¿È¤òÊÖ¤¹¤Î¤Ç¡¢°Ê²¼¤Î¤è¤¦¤ÊÉ½µ¤¬²ÄÇ½¤Ç¤¹¡£

      my $tokenized = $k->set('-w')->get($raw_japanese);

    ¥¹¥Æ¡¼¥¿¥¹¤¬Íß¤·¤¤¾ì¹ç¤Ë¤Ï¡¢ "$k->error" ¤ò»È¤¤¤Þ¤¹¡£

$k->error
    ºÇ¸å¤Ë¸Æ¤Ð¤ì¤¿¥á¥½¥Ã¥É¤Î¥¹¥Æ¡¼¥¿¥¹¤òÊÖ¤·¤Þ¤¹¡£

$processed = $k->get($raw_japanese);
    "do_kakasi" ¤Ø¤ÎOOP¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¡£°Ê²¼¤ÎÆó¤Ä¤Î¥³¡¼¥É¤ÏÅù²Á¤Ç¤¹¡£

      # Functional
      getopt_argv('-w'); $processed = do_kakasi($raw_japanese);
      # OOP
      $k->set('-w')->get($raw_japanese);

Perl 5.8 Features
Perl 5.8 ¤Ç¡¢Ê¸»ú¥³¡¼¥ÉÊÑ´¹¤ÎÉ¸½àÅª¤ÊÏÈÁÈ¤ß¤¬Encode¥â¥¸¥å¡¼¥ë¤Ë¤è¤Ã ¤ÆÄó¶¡¤µ¤ì¤Þ¤·¤¿¡£ËÜ¥â¥¸¥å¡¼¥ë¤Ï perl 5.8 °Ê¹ß¤Ë¤Æ¤³¤Îµ¡Ç½¤òÍøÍÑ¤¹¤ë¤è ¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£

"$k->set($args ...)"¤Ø¤Î°ú¿ô¤Ë¡¢"-iencoding" ¤ª¤è¤Ó "-oencoding"¡¡¤¬´Þ¤Þ¤ì¤ë¾ì¹ç¡¢Ê¸»ú¥³¡¼¥ÉÊÑ´¹¤ÏEncode¤¬¹Ô¤¤¤Þ¤¹¡£ °ú¿ô¤Ë¤Ïkakasi¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤â¤Î°Ê³°¤Ë¤â¡¢Encode¤¬¥µ¥Ý¡¼¥È¤·¤Æ ¤¤¤ë¤â¤Î¤ÏÁ´¤Æ»È¤¨¤Þ¤¹¡£ Îã¤¨¤Ð¡¢

  $result = $k->set(qw/-iutf8 -outf8 -w/)->get($utf8);

¤Ï°Ê²¼¤È¤Û¤ÜÆ±µÁ¤Ç¤¹¡£

  $euc = encode('eucjp' => $utf8);
  getopt_argv('-w');
  $tmp = do_kakasi($euc);
  $result = decode('eucjp' => $tmp);

"-outf8",¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ "$k->get" ¤Ïutf8¥Õ¥é¥°ÉÕ¤¤ÎÊ¸»ú Îó¤òÊÖ¤·¤Þ¤¹¡£

¤³¤ì¤é¤Îµ¡Ç½¤Ï¡¢ $Text::Kakasi::HAS_ENCODE¤Ë0¤òÀßÄê¤¹¤ë¤³¤È¤ÇÍøÍÑ¤· ¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤³¤È¤â²ÄÇ½¤Ç¤¹¡£ÄÌ¾ïÊÑ¿ô¤Ï¡¢ËÜ¥â¥¸¥å¡¼¥ë¤òuse¤·¤¿ºÝ¤Ë¼« Æ°Åª¤ËÀßÄê¤µ¤ì¤Þ¤¹¡£

SEE ALSO
kakasi(1), <http://kakasi.namazu.org/>,Encode,perlunicode

COPYRIGHT
  (C) 1998, 1999, 2000 NOKUBI Takatsugu <knok@daionet.gr.jp>
  (C) 2003 Dan Kogai <dankogai@dan.co.jp>

There is no warranty for this free software. Anyone can modify and/or redistribute this module under GNU GENERAL PUBLIC LICENSE. See COPYING file that is included in the archive for more details.

POD ERRORS
Hey! The above document had some coding errors, which are explained below:

Around line 7:
    Non-ASCII character seen before =encoding in 'ÆüËÜ¸ì¥É¥¥å¥á¥ó¥È'. Assuming CP1252