Text::CaboCha::Token - CaboCha Token Object
use utf8; use Encode; use Text::CaboCha; my $cabocha = Text::CaboCha->new(); my $text = encode(Text::CaboCha::ENCODING, "太郎は次郎が持っている本を花子に渡した。"); my $tree = $cabocha->parse($text); my $token_size = $tree->token_size; for (my $i = 0; $i < $token_size; $i++) { my $token = $tree->token($i); # do something } # You can get the chunk value from chunk object using below methods $token->surface; $token->normalized_surface; $token->feature; $token->feature_list; # array reference $token->feature_list_size; $token->ne; $token->additional_info; $token->chunk; # It will return Text::CaboCha::Chunk object
Text::CaboCha::Token encapsulates the cabocha token object.
Text::CaboCha Text::CaboCha::Chunk
Copyright (C) Kei Kamikawa.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
Kei Kamikawa <x00.x7f@gmail.com> @codehex
To install Text::CaboCha, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::CaboCha
CPAN shell
perl -MCPAN -e shell install Text::CaboCha
For more information on module installation, please visit the detailed CPAN module installation guide.