GitXplorerGitXplorer
s

keyword-merge

public
9 stars
1 forks
0 issues

Commits

List of commits on branch main.
Unverified
b94a243b03c4b2d4bda199147c6a9e2cb9ca6a7d

Update funding.yml

sspekulatius committed 2 years ago
Verified
56d41b4405c5ad5209128b97eb42e7739e95e8b1

Update FUNDING.yml

sspekulatius committed 2 years ago
Unverified
733a1a5cf0a5e40a66d51534f0d4628c5a56ca40

Adding PHP8 support

sspekulatius committed 3 years ago
Unverified
ecb59e3162b73181da3ced907ba2944a11d7e758

adjusting tests to match the new ignore word list

sspekulatius committed 4 years ago
Unverified
91494884d926486c1b023a7c470fca12f92d0a84

Adding longer ignore word list (in separate file)

sspekulatius committed 4 years ago
Unverified
1fa5d1d58c8dc7a87755c1cd9530e8d52d461cae

Allow for null to be passed in and handling it.

sspekulatius committed 4 years ago

README

The README file for this repository.

PHP Keyword Comparator / Merger

An helper to compare similarity of keywords or list of keyword.

You will still need to a make a final call which helper(s) to use and how to configure them.

This package is intended to be used with PHPScraper.

Sponsors

This project is sponsored by:

Want to sponsor this project? Contact me.

Install

composer require spekulatius/keyword-merge

At a glance

Here are a few impressions on the way the library works:

$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

You call also use arrays with correlated methods:

$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']

Keywords in URL Path

The library can also test for keywords in the URL path:

$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

Further example and cases can be found in the tests!

Related Links