Dan Kogai > Text-Kakasi-2.04 > Text::Kakasi::JP

Download:
Text-Kakasi-2.04.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

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.

syntax highlighting: