timostamm/text-scoring

安装: 7

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 0

开放问题: 0

语言:Puppet

dev-master 2017-10-03 16:11 UTC

This package is auto-updated.

Last update: 2024-09-05 18:29:11 UTC


README

该库根据加权关键词对输入文本进行评分。

它可以用来将一组兴趣与一系列关键词相关联,并评估给定文本的相关性。

示例

// We setup our keywords.
// If "VW" is present in the text, add 10 points to the score.
// If "Stammmarke" is present in the text, add 5 points to the score. 
$criteria = [
	new TextScoreKeyword('VW', 10), 
	new TextScoreKeyword('Stammmarke', 5)
];


// This is our example text. It contains both keywords, 
// so it should score 15 points.
$txt = 'Volkswagen (Abkürzung VW) ist die Stammmarke der Volkswagen AG.';
$scorer = new TextScorer($criteria);
$score = $scorer->score($txt);
print $score; // => 15