https://github.com/spekulatius/keyword-merge
A helper to compare and identify similar keywords using PHP.
https://github.com/spekulatius/keyword-merge
keyword-analysis keyword-extraction keyword-extractor keyword-match keyword-spotting php-scraper php-scrapper web-scraping
Last synced: about 2 months ago
JSON representation
A helper to compare and identify similar keywords using PHP.
- Host: GitHub
- URL: https://github.com/spekulatius/keyword-merge
- Owner: spekulatius
- License: gpl-3.0
- Created: 2020-10-06T12:45:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-28T10:44:10.000Z (about 2 years ago)
- Last Synced: 2024-06-20T06:23:46.797Z (12 months ago)
- Topics: keyword-analysis, keyword-extraction, keyword-extractor, keyword-match, keyword-spotting, php-scraper, php-scrapper, web-scraping
- Language: PHP
- Homepage: https://phpscraper.de/examples/extract-keywords.html
- Size: 47.9 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# 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](https://github.com/spekulatius/phpscraper).
## Sponsors
This project is sponsored by:
Want to sponsor this project? [Contact me](https://peterthaleikis.com/contact).
## Install
```bash
composer require spekulatius/keyword-merge
```## At a glance
Here are a few impressions on the way the library works:
```php
$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:
```php
$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:
```php
$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
- [Simple performance test between PHPScraper and Python3 BeautifulSoup](https://github.com/spekulatius/link-scraping-test-beautifulsoup-vs-phpscraper)
- [Keyword length distribution example with PHPScraper](https://github.com/spekulatius/phpscraper-keyword-length-distribution-example)
- [Keyword Scraping Example using PHPScraper](https://github.com/spekulatius/phpscraper-keyword-scraping-example)