-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
behnam
committed
Nov 26, 2018
1 parent
bfac695
commit ffc87b0
Showing
8 changed files
with
641 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Creative Investment Technologies | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,76 @@ | ||
# keyword-stuffing | ||
# Keyword Stuffing class | ||
This class helps to detect and remove keyword stuffing from a text. | ||
|
||
<a name="install"></a> | ||
## Installation | ||
|
||
``` | ||
$ composer require citco/keyword-stuffing | ||
``` | ||
|
||
```json | ||
{ | ||
"require": { | ||
"citco/keyword-stuffing": "*" | ||
} | ||
} | ||
``` | ||
|
||
```php | ||
<?php | ||
require './vendor/autoload.php'; | ||
|
||
use Citco\KeywordStuffing; | ||
|
||
$ks = new KeywordStuffing; | ||
``` | ||
|
||
<a name="sample-code"></a> | ||
### Sample code | ||
|
||
Here are some samples on using this class: | ||
```php | ||
$text_1 = $text_2 = <<<EOT | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque dictum in diam eu tristique. Mauris vel leo nec ex efficitur sodales at vitae nisi. Nulla facilisi. Integer consectetur vitae velit in vehicula. In fringilla justo a vehicula tempor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse vitae tempus nisl. Quisque sit amet aliquet libero. Integer eu elementum ligula. Nam feugiat dolor at diam tempus, at auctor quam tempor. Duis sed volutpat libero, nec dignissim justo. Nam nec eros ultricies, ultricies ex vel, accumsan libero. Aenean eleifend sed metus a lobortis. Etiam eu pellentesque dolor.<br> | ||
Curabitur sit amet congue nulla. Fusce tincidunt aliquam placerat. Phasellus consequat faucibus ex. Cras vel mauris vitae nibh semper finibus. Praesent dictum vestibulum turpis, non aliquam nisl. Donec lorem turpis, pellentesque id vehicula sit amet, efficitur vitae libero. Mauris at sapien nisl. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.<br> | ||
Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword<br> | ||
Maecenas tempus maximus odio id facilisis. Nulla sit amet efficitur magna. Ut quam nibh, malesuada eget facilisis at, porttitor ut sapien. Duis vitae mattis nunc. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus ultrices placerat lectus. Phasellus placerat orci at elit tincidunt, fringilla porta purus consequat. Donec tristique, enim id porta semper, mi risus vulputate dolor, et facilisis turpis ante eget nisl. Duis eget justo dolor. Nulla quis mi at eros sagittis dignissim. Curabitur vitae nibh ligula.<br> | ||
Morbi pretium ultrices ex, eu luctus tellus vulputate eget. Praesent quis enim non quam malesuada ullamcorper. Aliquam sed libero id quam vulputate luctus. In dapibus ipsum id libero elementum, vitae pulvinar tellus consequat. Donec quis tempor nunc. Proin pharetra lacus iaculis, tincidunt nulla non, hendrerit felis. Nulla facilisis elementum posuere. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin a quam sit amet elit maximus porta ac vel elit.<br> | ||
Morbi laoreet, neque ac pharetra placerat, ex risus condimentum enim, mattis porttitor ex augue vel mauris. Morbi felis elit, pulvinar in interdum vel, tincidunt sed ex. Integer feugiat tempus odio vel dignissim. Phasellus pulvinar libero at sem tincidunt sodales. Phasellus tincidunt auctor tortor, non accumsan mauris venenatis vitae. Etiam in vulputate ipsum, eget volutpat sem. Etiam eu faucibus nisi. Donec volutpat, justo vel pellentesque convallis, mi est pulvinar risus, vitae rhoncus turpis turpis quis felis. In tempor tellus non molestie rhoncus. Sed ut ligula leo. Ut aliquam elit a tortor aliquet, nec faucibus velit dignissim. Morbi posuere dignissim urna id pretium. Sed rutrum sollicitudin diam ut suscipit.<br> | ||
Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing<br> | ||
EOT; | ||
|
||
// Sample #1 | ||
$ks = new KeywordStuffing($text_1); | ||
$text = $ks->removeKeywordStuffing(); | ||
$summary = $ks->getSummary(); | ||
|
||
// Sample #2 | ||
$ks = new KeywordStuffing(); | ||
$text = $ks->removeKeywordStuffing($text_1); | ||
$summary = $ks->getSummary(); | ||
$text = $ks->removeKeywordStuffing($text_2); | ||
$summary = $ks->getSummary(); | ||
|
||
// Sample #3 | ||
$ks = new KeywordStuffing(); | ||
$summary = $ks->getSummary($text_1); | ||
$text = $ks->removeKeywordStuffing(); | ||
|
||
// Sample #4 | ||
$text = (new KeywordStuffing)->removeKeywordStuffing($text_1); | ||
``` | ||
|
||
<a name="issues"></a> | ||
### Issues | ||
Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/citco/keyword-stuffing/issues). | ||
|
||
<a name="requirements"></a> | ||
### Requirements | ||
|
||
PHP 5.4 or above | ||
|
||
<a name="license"></a> | ||
### License | ||
|
||
This source code is licensed under the MIT License - see the LICENSE file for details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "citco/keyword-stuffing", | ||
"description": "This class helps to detect and remove keyword stuffing from a text.", | ||
"keywords": ["keyword","stuffing"], | ||
"license": "MIT", | ||
"require": { | ||
"php": ">=5.5.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Citco\\": "src/" | ||
}, | ||
"files": ["src/stats_standard_deviation.php"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
require './vendor/autoload.php'; | ||
|
||
use Citco\KeywordStuffing; | ||
|
||
$text = file_get_contents('./sample.txt'); | ||
|
||
$ks = new KeywordStuffing(); | ||
$text = $ks->removeKeywordStuffing($text); | ||
$summary = $ks->getSummary(); | ||
|
||
echo $text; | ||
|
||
print_r($summary['word_dispersion_by_word']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque dictum in diam eu tristique. Mauris vel leo nec ex efficitur sodales at vitae nisi. Nulla facilisi. Integer consectetur vitae velit in vehicula. In fringilla justo a vehicula tempor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse vitae tempus nisl. Quisque sit amet aliquet libero. Integer eu elementum ligula. Nam feugiat dolor at diam tempus, at auctor quam tempor. Duis sed volutpat libero, nec dignissim justo. Nam nec eros ultricies, ultricies ex vel, accumsan libero. Aenean eleifend sed metus a lobortis. Etiam eu pellentesque dolor.<br> | ||
Curabitur sit amet congue nulla. Fusce tincidunt aliquam placerat. Phasellus consequat faucibus ex. Cras vel mauris vitae nibh semper finibus. Praesent dictum vestibulum turpis, non aliquam nisl. Donec lorem turpis, pellentesque id vehicula sit amet, efficitur vitae libero. Mauris at sapien nisl. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.<br> | ||
Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword Keyword<br> | ||
Maecenas tempus maximus odio id facilisis. Nulla sit amet efficitur magna. Ut quam nibh, malesuada eget facilisis at, porttitor ut sapien. Duis vitae mattis nunc. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus ultrices placerat lectus. Phasellus placerat orci at elit tincidunt, fringilla porta purus consequat. Donec tristique, enim id porta semper, mi risus vulputate dolor, et facilisis turpis ante eget nisl. Duis eget justo dolor. Nulla quis mi at eros sagittis dignissim. Curabitur vitae nibh ligula.<br> | ||
Morbi pretium ultrices ex, eu luctus tellus vulputate eget. Praesent quis enim non quam malesuada ullamcorper. Aliquam sed libero id quam vulputate luctus. In dapibus ipsum id libero elementum, vitae pulvinar tellus consequat. Donec quis tempor nunc. Proin pharetra lacus iaculis, tincidunt nulla non, hendrerit felis. Nulla facilisis elementum posuere. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin a quam sit amet elit maximus porta ac vel elit.<br> | ||
Morbi laoreet, neque ac pharetra placerat, ex risus condimentum enim, mattis porttitor ex augue vel mauris. Morbi felis elit, pulvinar in interdum vel, tincidunt sed ex. Integer feugiat tempus odio vel dignissim. Phasellus pulvinar libero at sem tincidunt sodales. Phasellus tincidunt auctor tortor, non accumsan mauris venenatis vitae. Etiam in vulputate ipsum, eget volutpat sem. Etiam eu faucibus nisi. Donec volutpat, justo vel pellentesque convallis, mi est pulvinar risus, vitae rhoncus turpis turpis quis felis. In tempor tellus non molestie rhoncus. Sed ut ligula leo. Ut aliquam elit a tortor aliquet, nec faucibus velit dignissim. Morbi posuere dignissim urna id pretium. Sed rutrum sollicitudin diam ut suscipit.<br> | ||
Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing Keyword stuffing<br> |
Oops, something went wrong.