spekulatius/keyword-merge

使用PHP比较和合并相似关键词的辅助工具。

3.0 2022-03-17 23:44 UTC

This package is auto-updated.

Last update: 2024-08-28 13:32:00 UTC


README

一个比较关键词或关键词列表相似度的辅助工具。

您仍需决定使用哪个辅助工具以及如何配置它们。

此包旨在与PHPScraper一起使用。

赞助商

本项目由以下机构赞助:

想要赞助本项目?联系我

安装

composer require spekulatius/keyword-merge

概览

以下是关于库工作方式的几点看法

$kwcmp = new Spekulatius\KeywordMerge\KeywordComparator;

$kwcmp->matchesWord('tbilisi georgia', 'is tbilisi the capital of georgia?');
// false

$kwcmp->containsWord('tbilisi georgia', 'is tbilisi the capital of georgia?');
// true

$kwcmp->similarWord('tbilisi georgia', 'georgias tbilisi');
// true

您也可以使用具有相关方法的数组

$kwcmp = new Spekulatius\KeywordMerge\KeywordComparator;

$kwcmp->matchesWords('tbilisi georgia', 'is tbilisi the capital of georgia?');
// []

$kwcmp->containsWords('tbilisi georgia', 'is tbilisi the capital of georgia?');
// ['is tbilisi the capital of georgia?']

$kwcmp->similarWords('tbilisi georgia', 'georgias tbilisi');
// ['georgias tbilisi']

URL路径中的关键词

该库还可以测试URL路径中的关键词

$kwcmp = new Spekulatius\KeywordMerge\KeywordComparator;

$kwcmp->inUrlPath('https://example.com/cats-are-awesome', 'seo tools');
// false

$kwcmp->inUrlPath('https://example.com/seo-tools', 'seo tools');
// true

$kwcmp->inUrlPath('https://example.com/chrome-seo-tools', 'chrome seo tools and toolkit');
// true - one word difference is accepted, from 3+ words

更多示例和案例可以在测试中找到!

相关链接