隣のチームの Tsukamoto さんが位置表現特定APIを Perl プログラムで利用するためのモジュールWebService::OkiLab::ExtractPlaceを作って CPAN に登録してくれたのでご紹介します。
使い方は以下の通り。
#!/usr/bin/perl
use WebService::OkiLab::ExtractPlace;
use Data::Dumper;
# must be UTF-8
my $text = '東京から名古屋駅を通過して大阪駅に着きました。';
$text .= '大阪市中央区本町に到着しました。';
my $explace = WebService::OkiLab::ExtractPlace->new;
my $result = $explace->extract($text);
print Dumper($result);
debian:~ 1007 % perl extract_place.pl
$VAR1 = {
'result_select' => [
[
{
'lat' => '34.702499',
'text' => '大阪駅',
'weight' => '1',
'type' => 'spot',
'lng' => '135.494982'
},
{
'lat' => '34.686394',
'text' => '大阪',
'weight' => '1',
'type' => 'spot',
'lng' => '135.519994'
},
{
'lat' => '34.683764',
'text' => '大阪市中央区本町',
'weight' => '1',
'type' => 'address',
'lng' => '135.509592'
},
{
'lat' => '34.682015',
'text' => '本町',
'weight' => '1',
'type' => 'spot',
'lng' => '135.499095'
}
]
]
};
詳細は perldoc を参照してください。






