Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created May 22, 2009 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/116041 to your computer and use it in GitHub Desktop.
Save kyanny/116041 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Lingua::JA::Summarize;
use Perl6::Say;
use Encode;
my $in = do { local $/; <>; };
my $s = Lingua::JA::Summarize->new({
charset => 'utf8',
mecab_charset => 'utf8',
default_cost => 1.8,
singlechar_factor => 0.2,
});
$s->analyze($in);
my @keywords = $s->keywords({
threshold => 4,
maxwords => 10,
minwords => 3,
});
for my $keyword (@keywords) {
say $keyword;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment