JpnForPhp\Analyzer\Analyzer::segment PHP Method

segment() public static method

Segments the given string to its various part of speech components
public static segment ( string $str ) : array
$str string The string to segment
return array Segments parts of the given string
    public static function segment($str)
    {
        $segmenter = new TinySegmenter();
        return $segmenter->segment($str);
    }

Usage Example

示例#1
0
 public function testSegmenterSentence3()
 {
     $result = Analyzer::segment('彼は自分の考えを言葉にするのが得意でない');
     $this->assertSame(array('彼', 'は', '自分', 'の', '考え', 'を', '言葉', 'に', 'する', 'の', 'が', '得意', 'で', 'ない'), $result);
 }