NAME
Lingua::ZH::Jieba::KeywordExtractor - Keyword extractor
VERSION
version 0.007
SYNOPSIS
use Lingua::ZH::Jieba;
binmode STDOUT, ":utf8";
my $jieba = Lingua::ZH::Jieba->new();
my $extractor = $jieba->extractor();
my $word_score = $extractor->extract(
"我是拖拉机学院手扶拖拉机专业的。不用多久,我就会升职加薪,当上CEO,走上人生巅峰。",
5
);
for my $pair (@$word_scores) {
my ($word, $score) = @$pair;
printf "%s:%.3f\n", $word, $score;
}
# CEO:11.739
# 升职:10.856
# 加薪:10.643
# 手扶拖拉机:10.009
# 巅峰:9.494
DESCRIPTION
This module is for keyword extraction.
METHODS
extract
Extract $top_n
keywords from $sentence
.
my $word_scores = $jieba->tag($sentence, $top_n);
for my $pair (@$word_scores) {
my ($word, $score) = @$pair;
...
}
SEE ALSO
AUTHOR
Stephan Loyd <stephanloyd9@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017-2023 by Stephan Loyd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.