Services_Yahoo_JP
[ class tree: Services_Yahoo_JP ] [ index: Services_Yahoo_JP ] [ all elements ]

Source for file MA.php

Documentation is available at MA.php

  1. <?php
  2. /**
  3.  * MA dispatcher
  4.  *
  5.  * PHP version 5
  6.  *
  7.  * LICENSE: This source file is subject to the New BSD license that is
  8.  * available through the world-wide-web at the following URI:
  9.  * http://www.opensource.org/licenses/bsd-license.php. If you did not receive
  10.  * a copy of the New BSD License and are unable to obtain it through the web,
  11.  * please send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @category  Services
  14.  * @package   Services_Yahoo_JP
  15.  * @author    Tetsuya Nakase <phpizer@gmail.com>
  16.  * @copyright 2008 Tetsuya Nakase
  17.  * @license   http://www.opensource.org/licenses/bsd-license.php BSD
  18.  * @version   CVS: $Id: MA.php,v 1.1 2008/04/28 15:59:31 tetsuya Exp $
  19.  * @link      http://phpize.net
  20.  */
  21.  
  22. require_once "Services/Yahoo/Exception.php";
  23.  
  24. /**
  25.  * MA dispatcher class
  26.  *
  27.  * This class provides a method to create a concrete instance of one
  28.  * of the supported MA types (parse).
  29.  *
  30.  * Morphological Analysis
  31.  * divide a Japanese sentence into a morpheme and
  32.  * offer the function that can acquire a part of speech,
  33.  * the grant of the phonetic symbol, statistics information.
  34.  *
  35.  * @category  Services
  36.  * @package   Services_Yahoo_JP
  37.  * @author    Tetsuya Nakase <phpizer@gmail.com>
  38.  * @copyright 2008 Tetsuya Nakase
  39.  * @license   http://www.opensource.org/licenses/bsd-license.php BSD
  40.  * @version   Release: 0.0.1
  41.  * @link      http://phpize.net
  42.  */
  43. {
  44.     /**
  45.      * Attempts to return a concrete instance of a MA class
  46.      *
  47.      * @param string $type Can be one of parse.
  48.      *
  49.      * @return  object Concrete instance of a MA class based on the paramter
  50.      * @throws  Services_Yahoo_Exception
  51.      */
  52.     public function factory($type)
  53.     {
  54.         switch ($type{
  55.         case 'parse' :
  56.             include_once 'Services/Yahoo/JP/MA/' $type '.php';
  57.             $classname 'Services_Yahoo_JP_MA_' ucfirst($type);
  58.             return new $classname;
  59.         default :
  60.             throw new Services_Yahoo_Exception('Unknown MA type ' $type);
  61.             break;
  62.         }
  63.     }
  64. }
  65. ?>

Documentation generated on Fri, 19 Sep 2008 21:30:06 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.