├── .github └── workflows │ └── main.yml ├── .gitignore ├── .styleci.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── assets └── icon.png ├── composer.json ├── config └── config.php ├── phpunit.xml ├── src ├── Abstracts │ └── StringNormalizer.php ├── BlaspExpressionService.php ├── BlaspService.php ├── Console │ └── Commands │ │ └── BlaspClearCommand.php ├── Facades │ └── Blasp.php ├── Normalizers │ ├── EnglishStringNormalizer.php │ ├── FrenchStringNormalizer.php │ └── Normalize.php ├── ProfanityDetector.php ├── ServiceProvider.php └── Traits │ └── BlaspCache.php └── tests ├── BlaspCheckTest.php ├── BlaspCheckValidationTest.php └── TestCase.php /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | # Step 1: Check out the repository 11 | - name: Checkout code 12 | uses: actions/checkout@v4 13 | 14 | # Step 2: Set up PHP 15 | - name: Set up PHP 16 | uses: shivammathur/setup-php@v2 17 | with: 18 | php-version: "8.2" # Set your desired PHP version 19 | extensions: mbstring, dom, zip 20 | 21 | # Step 3: Install Composer dependencies 22 | - name: Install dependencies 23 | run: composer install --no-interaction --prefer-dist 24 | 25 | # Step 4: Run PHPUnit tests 26 | - name: Run tests 27 | run: php ./vendor/bin/phpunit 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.lock 3 | .phpunit.result.cache 4 | /.idea -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: laravel 2 | 3 | disabled: 4 | - single_class_element_per_statement 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `blasp` will be documented in this file 4 | 5 | ## 1.0.0 - 201X-XX-XX 6 | 7 | - initial release 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | Please read and understand the contribution guide before creating an issue or pull request. 6 | 7 | ## Etiquette 8 | 9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code 10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be 11 | extremely unfair for them to suffer abuse or anger for their hard work. 12 | 13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the 14 | world that developers are civilized and selfless people. 15 | 16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient 17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 18 | 19 | ## Viability 20 | 21 | When requesting or submitting new features, first consider whether it might be useful to others. Open 22 | source projects are used by many developers, who may have entirely different needs to your own. Think about 23 | whether or not your feature is likely to be used by other users of the project. 24 | 25 | ## Procedure 26 | 27 | Before filing an issue: 28 | 29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 30 | - Check to make sure your feature suggestion isn't already present within the project. 31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 32 | - Check the pull requests tab to ensure that the feature isn't already in progress. 33 | 34 | Before submitting a pull request: 35 | 36 | - Check the codebase to ensure that your feature doesn't already exist. 37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 38 | 39 | ## Requirements 40 | 41 | If the project maintainer has any additional requirements, you will find them listed here. 42 | 43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). 44 | 45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 46 | 47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 48 | 49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. 50 | 51 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 52 | 53 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 54 | 55 | **Happy coding**! 56 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Michael Deeming 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Blasp Icon 3 |

4 | GitHub Workflow Status (main) 5 | Total Downloads 6 | Latest Version 7 | License 8 |

9 |

10 | 11 | # Blasp - Profanity Filter for Laravel 12 | 13 | Blasp is a profanity filter package for Laravel that helps detect and mask profane words in a given sentence. It offers a robust set of features for handling variations of offensive language, including substitutions, obscured characters, and doubled letters. 14 | 15 | ## Installation 16 | 17 | You can install the package via Composer: 18 | 19 | ```bash 20 | composer require blaspsoft/blasp 21 | ``` 22 | 23 | ## Usage 24 | 25 | ### Basic Usage 26 | 27 | To use the profanity filter, simply call the `Blasp::check()` method with the sentence you want to check for profanity. 28 | 29 | ```php 30 | use Blaspsoft\Blasp\Facades\Blasp; 31 | 32 | $sentence = 'This is a fucking shit sentence'; 33 | $check = Blasp::check($sentence); 34 | ``` 35 | 36 | The returned object will contain the following properties: 37 | 38 | - **sourceString**: The original string you passed. 39 | - **cleanString**: The string with profanities masked (e.g., replaced with `*`). 40 | - **hasProfanity**: A boolean indicating whether the string contains profanity. 41 | - **profanitiesCount**: The number of profanities found. 42 | - **uniqueProfanitiesFound**: An array of unique profanities found in the string. 43 | 44 | ### Example 45 | 46 | ```php 47 | $sentence = 'This is a fucking shit sentence'; 48 | $blasp = Blasp::check($sentence); 49 | 50 | $blasp->getSourceString(); // "This is a fucking shit sentence" 51 | $blasp->getCleanString(); // "This is a ******* **** sentence" 52 | $blasp->hasProfanity(); // true 53 | $blasp->getProfanitiesCount(); // 2 54 | $blasp->getUniqueProfanitiesFound(); // ['fucking', 'shit'] 55 | ``` 56 | 57 | ### Profanity Detection Types 58 | 59 | Blasp can detect different types of profanities based on variations such as: 60 | 61 | 1. **Straight match**: Direct matches of profane words. 62 | 2. **Substitution**: Substituted characters (e.g., `pro0fán1ty`). 63 | 3. **Obscured**: Profanities with separators (e.g., `p-r-o-f-a-n-i-t-y`). 64 | 4. **Doubled**: Repeated letters (e.g., `pprrooffaanniittyy`). 65 | 5. **Combination**: Combinations of the above (e.g., `pp-rof@n|tty`). 66 | 67 | ### Laravel Validation Rule 68 | 69 | Blasp also provides a custom Laravel validation rule called `blasp_check`, which you can use to validate form input for profanity. 70 | 71 | #### Example 72 | 73 | ```php 74 | $request->merge(['sentence' => 'This is f u c k 1 n g awesome!']); 75 | 76 | $validated = $request->validate([ 77 | 'sentence' => ['blasp_check'], 78 | ]); 79 | ``` 80 | 81 | ### Configuration 82 | 83 | Blasp uses a configuration file (`config/blasp.php`) to manage the list of profanities, separators, and substitutions. You can publish the configuration file using the following Artisan command: 84 | 85 | ```bash 86 | php artisan vendor:publish --tag="blasp-config" 87 | ``` 88 | 89 | ### Custom Configuration 90 | 91 | You can specify custom profanity and false positive lists using the `configure()` method: 92 | 93 | ```php 94 | use Blaspsoft\Blasp\Facades\Blasp; 95 | 96 | $blasp = Blasp::configure( 97 | profanities: $your_custom_profanities, 98 | falsePositives: $your_custom_false_positives 99 | )->check($text); 100 | ``` 101 | 102 | This is particularly useful when you need different profanity rules for specific contexts, such as username validation. 103 | 104 | ### Cache Management 105 | 106 | Blasp uses Laravel's cache system to improve performance. The package automatically caches profanity expressions and their variations. To clear the cache, you can use the provided Artisan command: 107 | 108 | ```bash 109 | php artisan blasp:clear 110 | ``` 111 | 112 | This command will clear all cached Blasp expressions and configurations. 113 | 114 | ## License 115 | 116 | Blasp is open-sourced software licensed under the [MIT license](LICENSE). 117 | -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blaspsoft/blasp/d60a6525cff7263736781ccd8d3b137af8de6fcd/assets/icon.png -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blaspsoft/blasp", 3 | "description": "Blasp is a powerful and customisable profanity filter package for Laravel applications", 4 | "keywords": [ 5 | "blaspsoft", 6 | "blasp" 7 | ], 8 | "homepage": "https://github.com/blaspsoft/blasp", 9 | "license": "MIT", 10 | "type": "library", 11 | "authors": [ 12 | { 13 | "name": "Michael Deeming", 14 | "email": "michael.deeming90@gmail.com", 15 | "role": "Developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "^8.2", 20 | "illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0" 21 | }, 22 | "require-dev": { 23 | "orchestra/testbench": "^10.0", 24 | "phpunit/phpunit": "^11.0" 25 | }, 26 | "autoload": { 27 | "psr-4": { 28 | "Blaspsoft\\Blasp\\": "src/" 29 | } 30 | }, 31 | "autoload-dev": { 32 | "psr-4": { 33 | "Blaspsoft\\Blasp\\Tests\\": "tests" 34 | } 35 | }, 36 | "minimum-stability": "stable", 37 | "prefer-stable": true, 38 | "scripts": { 39 | "test": "vendor/bin/phpunit", 40 | "test-coverage": "vendor/bin/phpunit --coverage-html coverage" 41 | }, 42 | "config": { 43 | "sort-packages": true 44 | }, 45 | "extra": { 46 | "laravel": { 47 | "providers": [ 48 | "Blaspsoft\\Blasp\\ServiceProvider" 49 | ], 50 | "aliases": { 51 | "Blasp": "Blaspsoft\\Blasp\\Facades\\Blasp" 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | [ 15 | '@', 16 | '#', 17 | '%', 18 | '&', 19 | '_', 20 | ';', 21 | "'", 22 | '"', 23 | ',', 24 | '~', 25 | '`', 26 | '|', 27 | '!', 28 | '$', 29 | '^', 30 | '*', 31 | '(', 32 | ')', 33 | '-', 34 | '+', 35 | '=', 36 | '{', 37 | '}', 38 | '[', 39 | ']', 40 | ':', 41 | '<', 42 | '>', 43 | '?', 44 | '.', 45 | '/', 46 | ], 47 | 48 | /* 49 | |-------------------------------------------------------------------------- 50 | | Character Substitutions 51 | |-------------------------------------------------------------------------- 52 | | 53 | | An array of alpha characters and their possible substitutions. 54 | | 55 | | 56 | */ 57 | 'substitutions' => [ 58 | '/a/' => ['a', '4', '@', 'Á', 'á', 'À', 'Â', 'à', 'Â', 'â', 'Ä', 'ä', 'Ã', 'ã', 'Å', 'å', 'æ', 'Æ', 'α', 'Δ', 'Λ', 'λ'], 59 | '/b/' => ['b', '8', '\\', '3', 'ß', 'Β', 'β'], 60 | '/c/' => ['c', 'Ç', 'ç', 'ć', 'Ć', 'č', 'Č', '¢', '€', '<', '(', '{', '©'], 61 | '/d/' => ['d', '\\', ')', 'Þ', 'þ', 'Ð', 'ð'], 62 | '/e/' => ['e', '3', '€', 'È', 'è', 'É', 'é', 'Ê', 'ê', 'ë', 'Ë', 'ē', 'Ē', 'ė', 'Ė', 'ę', 'Ę', '∑'], 63 | '/f/' => ['f', 'ƒ'], 64 | '/g/' => ['g', '6', '9'], 65 | '/h/' => ['h', 'Η'], 66 | '/i/' => ['i', '!', '|', ']', '[', '1', '∫', 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'ī', 'Ī', 'į', 'Į'], 67 | '/j/' => ['j'], 68 | '/k/' => ['k', 'Κ', 'κ'], 69 | '/l/' => ['l', '!', '|', ']', '[', '£', '∫', 'Ì', 'Í', 'Î', 'Ï', 'ł', 'Ł'], 70 | '/m/' => ['m'], 71 | '/n/' => ['n', 'η', 'Ν', 'Π', 'ñ', 'Ñ', 'ń', 'Ń'], 72 | '/o/' => ['o', '0', 'Ο', 'ο', 'Φ', '¤', '°', 'ø', 'ô', 'Ô', 'ö', 'Ö', 'ò', 'Ò', 'ó', 'Ó', 'œ', 'Œ', 'ø', 'Ø', 'ō', 'Ō', 'õ', 'Õ'], 73 | '/p/' => ['p', 'ρ', 'Ρ', '¶', 'þ'], 74 | '/q/' => ['q'], 75 | '/r/' => ['r', '®'], 76 | '/s/' => ['s', '5', '\$', '§', 'ß', 'Ś', 'ś', 'Š', 'š'], 77 | '/t/' => ['t', 'Τ', 'τ'], 78 | '/u/' => ['u', 'υ', 'µ', 'û', 'ü', 'ù', 'ú', 'ū', 'Û', 'Ü', 'Ù', 'Ú', 'Ū'], 79 | '/v/' => ['v', 'υ', 'ν'], 80 | '/w/' => ['w', 'ω', 'ψ', 'Ψ'], 81 | '/x/' => ['x', 'Χ', 'χ'], 82 | '/y/' => ['y', '¥', 'γ', 'ÿ', 'ý', 'Ÿ', 'Ý'], 83 | '/z/' => ['z', 'Ζ', 'ž', 'Ž', 'ź', 'Ź', 'ż', 'Ż'], 84 | ], 85 | 86 | /* 87 | |-------------------------------------------------------------------------- 88 | | False Positives 89 | |-------------------------------------------------------------------------- 90 | | 91 | | An array of false positives 92 | | 93 | | 94 | */ 95 | 'false_positives' => [ 96 | 'hello', 97 | 'scunthorpe', 98 | 'cockburn', 99 | 'penistone', 100 | 'lightwater', 101 | 'assume', 102 | 'bass', 103 | 'class', 104 | 'compass', 105 | 'pass', 106 | 'dickinson', 107 | 'middlesex', 108 | 'cockerel', 109 | 'butterscotch', 110 | 'blackcock', 111 | 'countryside', 112 | 'arsenal', 113 | 'flick', 114 | 'flicker', 115 | 'analyst', 116 | 'cocktail', 117 | 'musicals hit', 118 | 'is hit', 119 | 'blackcocktail', 120 | 'its not', 121 | ], 122 | 123 | 124 | /* 125 | |-------------------------------------------------------------------------- 126 | | Profanities 127 | |-------------------------------------------------------------------------- 128 | | 129 | | An array of profanities 130 | | 131 | | 132 | */ 133 | 'profanities' => [ 134 | 'abbo', 135 | 'abortionist', 136 | 'abuser', 137 | 'ahole', 138 | 'alabama hotpocket', 139 | 'alligatorbait', 140 | 'anal', 141 | 'analannie', 142 | 'analsex', 143 | 'areola', 144 | 'arse', 145 | 'arsebagger', 146 | 'arsebandit', 147 | 'arseblaster', 148 | 'arsecowboy', 149 | 'arsefuck', 150 | 'arsefucker', 151 | 'arsehat', 152 | 'arsehole', 153 | 'arseholes', 154 | 'arsehore', 155 | 'arsejockey', 156 | 'arsekiss', 157 | 'arsekisser', 158 | 'arselick', 159 | 'arselicker', 160 | 'arselover', 161 | 'arseman', 162 | 'arsemonkey', 163 | 'arsemunch', 164 | 'arsemuncher', 165 | 'arsepacker', 166 | 'arsepirate', 167 | 'arsepuppies', 168 | 'arseranger', 169 | 'arses', 170 | 'arsewhore', 171 | 'arsewipe', 172 | 'ass', 173 | 'assbag', 174 | 'assbagger', 175 | 'assbandit', 176 | 'assbanger', 177 | 'assbite', 178 | 'assblaster', 179 | 'assclown', 180 | 'asscock', 181 | 'asscowboy', 182 | 'asscracker', 183 | 'asses', 184 | 'assface', 185 | 'assfuck', 186 | 'assfucker', 187 | 'assgoblin', 188 | 'ass-hat', 189 | 'asshat', 190 | 'asshead', 191 | 'asshole', 192 | 'assholes', 193 | 'assholz', 194 | 'asshopper', 195 | 'asshore', 196 | 'ass-jabber', 197 | 'assjacker', 198 | 'assjockey', 199 | 'asskiss', 200 | 'asskisser', 201 | 'assklown', 202 | 'asslick', 203 | 'asslicker', 204 | 'asslover', 205 | 'assman', 206 | 'assmonkey', 207 | 'ass monkey', 208 | 'assmunch', 209 | 'assmuncher', 210 | 'assnigger', 211 | 'asspacker', 212 | 'ass-pirate', 213 | 'asspirate', 214 | 'asspuppies', 215 | 'assranger', 216 | 'assshit', 217 | 'assshole', 218 | 'asssucker', 219 | 'asswad', 220 | 'asswhore', 221 | 'asswipe', 222 | 'axwound', 223 | 'azzhole', 224 | 'backdoorman', 225 | 'badfuck', 226 | 'baldy', 227 | 'ball licker', 228 | 'balllicker', 229 | 'ballsack', 230 | 'bampot', 231 | 'banging', 232 | 'barelylegal', 233 | 'barface', 234 | 'barfface', 235 | 'bassterds', 236 | 'bastard', 237 | 'bastards', 238 | 'bastardz', 239 | 'basterds', 240 | 'basterdz', 241 | 'bazongas', 242 | 'bazooms', 243 | 'beaner', 244 | 'beastality', 245 | 'beastial', 246 | 'beastiality', 247 | 'beat-off', 248 | 'beatoff', 249 | 'beatyourmeat', 250 | 'bestial', 251 | 'bestiality', 252 | 'biatch', 253 | 'bicurious', 254 | 'bigass', 255 | 'bigbastard', 256 | 'bigbutt', 257 | 'bitch', 258 | 'bitchass', 259 | 'bitcher', 260 | 'bitches', 261 | 'bitchez', 262 | 'bitchin', 263 | 'bitching', 264 | 'bitchslap', 265 | 'bitchtits', 266 | 'bitchy', 267 | 'biteme', 268 | 'blow job', 269 | 'blowjob', 270 | 'boffing', 271 | 'bohunk', 272 | 'bollick', 273 | 'bollock', 274 | 'bollocks', 275 | 'bollox', 276 | 'bondage', 277 | 'boner', 278 | 'boob', 279 | 'boobies', 280 | 'boobs', 281 | 'booby', 282 | 'bootycall', 283 | 'bountybar', 284 | 'breastjob', 285 | 'breastlover', 286 | 'breastman', 287 | 'brothel', 288 | 'brotherfucker', 289 | 'bugger', 290 | 'buggered', 291 | 'buggery', 292 | 'bukake', 293 | 'bullcrap', 294 | 'bulldike', 295 | 'bulldyke', 296 | 'bullshit', 297 | 'bumblefuck', 298 | 'bumfuck', 299 | 'bungabunga', 300 | 'bunghole', 301 | 'butchbabes', 302 | 'butchdike', 303 | 'butchdyke', 304 | 'butt-bang', 305 | 'buttbang', 306 | 'buttcheeks', 307 | 'buttface', 308 | 'butt-fuck', 309 | 'buttfuck', 310 | 'buttfucka', 311 | 'butt-fucker', 312 | 'buttfucker', 313 | 'butt-fuckers', 314 | 'buttfuckers', 315 | 'butthead', 316 | 'butthole', 317 | 'buttman', 318 | 'buttmunch', 319 | 'buttmuncher', 320 | 'butt-pirate', 321 | 'buttpirate', 322 | 'butt plug', 323 | 'buttplug', 324 | 'buttstain', 325 | 'buttwipe', 326 | 'byatch', 327 | 'cacker', 328 | 'cameljockey', 329 | 'camel toe', 330 | 'cameltoe', 331 | 'carpet muncher', 332 | 'carpetmuncher', 333 | 'cawk', 334 | 'cawks', 335 | 'chav', 336 | 'cherrypopper', 337 | 'chesticle', 338 | 'chickslick', 339 | 'chinc', 340 | 'chink', 341 | 'choad', 342 | 'chode', 343 | 'clamdigger', 344 | 'clamdiver', 345 | 'clit', 346 | 'clitface', 347 | 'clitfuck', 348 | 'clitoris', 349 | 'clogwog', 350 | 'clunge', 351 | 'clusterfuck', 352 | 'cnts', 353 | 'cntz', 354 | 'cock', 355 | 'cockass', 356 | 'cockbite', 357 | 'cockblock', 358 | 'cockblocker', 359 | 'cockburger', 360 | 'cockcowboy', 361 | 'cockface', 362 | 'cockfight', 363 | 'cockfucker', 364 | 'cock-head', 365 | 'cockhead', 366 | 'cockjockey', 367 | 'cockknob', 368 | 'cockknoker', 369 | 'cocklicker', 370 | 'cocklover', 371 | 'cockmaster', 372 | 'cockmongler', 373 | 'cockmongruel', 374 | 'cockmonkey', 375 | 'cockmuncher', 376 | 'cocknob', 377 | 'cocknose', 378 | 'cocknugget', 379 | 'cockqueen', 380 | 'cockrider', 381 | 'cocks', 382 | 'cockshit', 383 | 'cocksman', 384 | 'cocksmith', 385 | 'cocksmoke', 386 | 'cocksmoker', 387 | 'cocksniffer', 388 | 'cocksucer', 389 | 'cocksuck', 390 | 'cocksucked', 391 | 'cock-sucker', 392 | 'cocksucker', 393 | 'cocksucking', 394 | 'cocktease', 395 | 'cockwaffle', 396 | 'cocky', 397 | 'coitus', 398 | 'cok', 399 | 'commie', 400 | 'coochie', 401 | 'coochy', 402 | 'coon', 403 | 'coondog', 404 | 'cooter', 405 | 'copulate', 406 | 'cracker', 407 | 'crackpipe', 408 | 'crack-whore', 409 | 'crackwhore', 410 | 'crap', 411 | 'crappy', 412 | 'crotchjockey', 413 | 'crotchmonkey', 414 | 'crotchrot', 415 | 'cuck', 416 | 'cum', 417 | 'cumbubble', 418 | 'cumdumpster', 419 | 'cumfest', 420 | 'cumguzzler', 421 | 'cumjockey', 422 | 'cumm', 423 | 'cumquat', 424 | 'cumqueen', 425 | 'cumshot', 426 | 'cumslut', 427 | 'cumtart', 428 | 'cunilingus', 429 | 'cunillingus', 430 | 'cunnie', 431 | 'cunnilingus', 432 | 'cunntt', 433 | 'cunt', 434 | 'cuntass', 435 | 'cunteyed', 436 | 'cuntface', 437 | 'cuntfucker', 438 | 'cunthole', 439 | 'cuntlick', 440 | 'cuntlicker', 441 | 'cuntlicker', 442 | 'cuntlicking', 443 | 'cuntrag', 444 | 'cunts', 445 | 'cuntslut', 446 | 'cuntsucker', 447 | 'cuntz', 448 | 'cybersex', 449 | 'cyberslimer', 450 | 'dago', 451 | 'dammit', 452 | 'damn', 453 | 'damnation', 454 | 'damnit', 455 | 'darkie', 456 | 'darky', 457 | 'datnigga', 458 | 'deapthroat', 459 | 'deepthroat', 460 | 'deggo', 461 | 'dego', 462 | 'devilworshipper', 463 | 'dick', 464 | 'dickbag', 465 | 'dickbeaters', 466 | 'dickbrain', 467 | 'dickface', 468 | 'dickforbrains', 469 | 'dickfuck', 470 | 'dickfucker', 471 | 'dickhead', 472 | 'dickhole', 473 | 'dickjuice', 474 | 'dickless', 475 | 'dicklick', 476 | 'dicklicker', 477 | 'dickmilk', 478 | 'dickmonger', 479 | 'dicks', 480 | 'dickslap', 481 | 'dick-sneeze', 482 | 'dicksucker', 483 | 'dicksucking', 484 | 'dicktickler', 485 | 'dickwad', 486 | 'dickweasel', 487 | 'dickweed', 488 | 'dickwod', 489 | 'dike', 490 | 'dildo', 491 | 'dildos', 492 | 'dilldo', 493 | 'dilldos', 494 | 'dipshit', 495 | 'dipstick', 496 | 'dixiedike', 497 | 'dixiedyke', 498 | 'doggiestyle', 499 | 'doggystyle', 500 | 'dominatricks', 501 | 'dominatrics', 502 | 'dominatrix', 503 | 'doochbag', 504 | 'dookie', 505 | 'douch', 506 | 'douchbag', 507 | 'douche', 508 | 'douchebag', 509 | 'douche-fag', 510 | 'douchewaffle', 511 | 'drag queen', 512 | 'dragqueen', 513 | 'dragqween', 514 | 'dripdick', 515 | 'dumass', 516 | 'dumb ass', 517 | 'dumbass', 518 | 'dumbbitch', 519 | 'dumbfuck', 520 | 'dumbshit', 521 | 'dumshit', 522 | 'dyke', 523 | 'easyslut', 524 | 'eatballs', 525 | 'eatme', 526 | 'eatpussy', 527 | 'ejaculate', 528 | 'ejaculated', 529 | 'ejaculating', 530 | 'ejaculation', 531 | 'enema', 532 | 'excrement', 533 | 'facefucker', 534 | 'facist', 535 | 'faeces', 536 | 'fag', 537 | 'fagbag', 538 | 'faget', 539 | 'fagfucker', 540 | 'fagging', 541 | 'faggit', 542 | 'faggot', 543 | 'faggotcock', 544 | 'faggots', 545 | 'fagit', 546 | 'fagot', 547 | 'fags', 548 | 'fagtard', 549 | 'fagz', 550 | 'faig', 551 | 'faigs', 552 | 'fannyfucker', 553 | 'fark', 554 | 'farted', 555 | 'farting', 556 | 'farty', 557 | 'fastfuck', 558 | 'fatass', 559 | 'fatfuck', 560 | 'fatfucker', 561 | 'fatso', 562 | 'feces', 563 | 'felatio', 564 | 'felch', 565 | 'felcher', 566 | 'felching', 567 | 'fellatio', 568 | 'feltch', 569 | 'feltcher', 570 | 'feltching', 571 | 'fingerfuck', 572 | 'fingerfucked', 573 | 'fingerfucker', 574 | 'fingerfuckers', 575 | 'fingerfucking', 576 | 'fister', 577 | 'fistfuck', 578 | 'fistfucked', 579 | 'fistfucker', 580 | 'fistfucking', 581 | 'fisting', 582 | 'flamer', 583 | 'flasher', 584 | 'flid', 585 | 'flipping the bird', 586 | 'flyd', 587 | 'flydie', 588 | 'flydye', 589 | 'fondle', 590 | 'footaction', 591 | 'footfuck', 592 | 'footfucker', 593 | 'footlicker', 594 | 'fornicate', 595 | 'freakfuck', 596 | 'freakyfucker', 597 | 'freefuck', 598 | 'fubar', 599 | 'fucck', 600 | 'fuck', 601 | 'fucka', 602 | 'fuckable', 603 | 'fuckass', 604 | 'fuckbag', 605 | 'fuckboy', 606 | 'fuckbrain', 607 | 'fuckbuddy', 608 | 'fuckbutt', 609 | 'fuckbutter', 610 | 'fucked', 611 | 'fucker', 612 | 'fuckers', 613 | 'fuckersucker', 614 | 'fuckface', 615 | 'fuckfest', 616 | 'fuckfreak', 617 | 'fuckfriend', 618 | 'fuckhead', 619 | 'fuckher', 620 | 'fuckhole', 621 | 'fuckin', 622 | 'fuckina', 623 | 'fucking', 624 | 'fuckingbitch', 625 | 'fuckinnuts', 626 | 'fuckinright', 627 | 'fuckit', 628 | 'fuckknob', 629 | 'fuckme', 630 | 'fuckmehard', 631 | 'fuckmonkey', 632 | 'fucknut', 633 | 'fucknutt', 634 | 'fuckoff', 635 | 'fuckpig', 636 | 637 | 'fuckstick', 638 | 'fucktard', 639 | 'fucktart', 640 | 'fuckup', 641 | 'fuckwad', 642 | 'fuckwhore', 643 | 'fuckwit', 644 | 'fuckwitt', 645 | 'fuckyou', 646 | 'fudge packer', 647 | 'fudgepacker', 648 | 'Fudge Packer', 649 | 'fugly', 650 | 'fuk', 651 | 'Fukah', 652 | 'Fuken', 653 | 'fuker', 654 | 'Fukin', 655 | 'Fukk', 656 | 'Fukkah', 657 | 'Fukken', 658 | 'Fukker', 659 | 'Fukkin', 660 | 'fuks', 661 | 'funfuck', 662 | 'fuuck', 663 | 'gang bang', 664 | 'gangbang', 665 | 'gangbanged', 666 | 'gangbanger', 667 | 'gatorbait', 668 | 'gayass', 669 | 'gaybob', 670 | 'gayboy', 671 | 'gaydo', 672 | 'gayfuck', 673 | 'gayfuckist', 674 | 'gaygirl', 675 | 'gaylord', 676 | 'gaymuthafuckinwhore', 677 | 'gays', 678 | 'gaysex', 679 | 'gaytard', 680 | 'gaywad', 681 | 'gayz', 682 | 'getiton', 683 | 'givehead', 684 | 'glazeddonut', 685 | 'godammit', 686 | 'goddamit', 687 | 'goddammit', 688 | 'goddamn', 689 | 'goddamned', 690 | 'god-damned', 691 | 'goddamnes', 692 | 'goddamnit', 693 | 'goddamnmuthafucker', 694 | 'goldenshower', 695 | 'gonorrehea', 696 | 'gonzagas', 697 | 'gooch', 698 | 'gook', 699 | 'gotohell', 700 | 'greaseball', 701 | 'gringo', 702 | 'grostulation', 703 | 'guido', 704 | 'gypo', 705 | 'gypp', 706 | 'gyppie', 707 | 'gyppo', 708 | 'gyppy', 709 | 'handjob', 710 | 'hard on', 711 | 'hardon', 712 | 'headfuck', 713 | 'heeb', 714 | 'hell', 715 | 'herpes', 716 | 'hijacker', 717 | 'hijacking', 718 | 'hillbillies', 719 | 'hindoo', 720 | 'hitler', 721 | 'hitlerism', 722 | 'hitlerist', 723 | 'hoar', 724 | 'hobo', 725 | 'hoe', 726 | 'hoes', 727 | 'holestuffer', 728 | 'homo', 729 | 'homobangers', 730 | 'homodumbshit', 731 | 'honger', 732 | 'honkers', 733 | 'honkey', 734 | 'honky', 735 | 'hookers', 736 | 'hoor', 737 | 'hoore', 738 | 'hore', 739 | 'horney', 740 | 'horniest', 741 | 'horny', 742 | 'horseshit', 743 | 'hosejob', 744 | 'hotdamn', 745 | 'hotpussy', 746 | 'hottotrot', 747 | 'humping', 748 | 'hymen', 749 | 'iblowu', 750 | 'idiot', 751 | 'incest', 752 | 'insest', 753 | 'internet wife', 754 | 'inthebuff', 755 | 'jackass', 756 | 'jackoff', 757 | 'jackshit', 758 | 'jagoff', 759 | 'jap', 760 | 'japcrap', 761 | 'japs', 762 | 'jerkass', 763 | 'jerk off', 764 | 'jerk-off', 765 | 'jerkoff', 766 | 'jesuschrist', 767 | 'jigaboo', 768 | 'jiggabo', 769 | 'jihad', 770 | 'jijjiboo', 771 | 'jisim', 772 | 'jism', 773 | 'jiss', 774 | 'jizim', 775 | 'jizjuice', 776 | 'jizm', 777 | 'jizm', 778 | 'jizz', 779 | 'jizzim', 780 | 'jizzum', 781 | 'jubblies', 782 | 'juggalo', 783 | 'jungle bunny', 784 | 'junglebunny', 785 | 'kiddy fiddler', 786 | 'kike', 787 | 'kinky', 788 | 'kissass', 789 | 'knobz', 790 | 'kondum', 791 | 'kooch', 792 | 'kootch', 793 | 'krap', 794 | 'krappy', 795 | 'kraut', 796 | 'kumbubble', 797 | 'kumbullbe', 798 | 'kummer', 799 | 'kumming', 800 | 'kums', 801 | 'kunilingus', 802 | 'kunnilingus', 803 | 'kunt', 804 | 'kunts', 805 | 'kuntz', 806 | 'kyke', 807 | 'labia', 808 | 'lactate', 809 | 'lady boy', 810 | 'ladyboy', 811 | 'lameass', 812 | 'lapdance', 813 | 'lardass', 814 | 'lesbain', 815 | 'lesbayn', 816 | 'lesbian', 817 | 'lesbin', 818 | 'lesbo', 819 | 'lezbe', 820 | 'lezbefriends', 821 | 'lezbo', 822 | 'lezz', 823 | 'lezzer', 824 | 'lezzie', 825 | 'lezzo', 826 | 'libido', 827 | 'lickme', 828 | 'limpdick', 829 | 'lipshits', 830 | 'lipshitz', 831 | 'livesex', 832 | 'lmfao', 833 | 'loadedgun', 834 | 'lovebone', 835 | 'lovegoo', 836 | 'lovegun', 837 | 'lovejuice', 838 | 'lovemuscle', 839 | 'lovepistol', 840 | 'loverocket', 841 | 'low life', 842 | 'lowlife', 843 | 'lubejob', 844 | 'luckycameltoe', 845 | 'manhater', 846 | 'manpaste', 847 | 'masochist', 848 | 'masokist', 849 | 'massterbait', 850 | 'masstrbait', 851 | 'masstrbate', 852 | 'mastabate', 853 | 'mastabater', 854 | 'masterbaiter', 855 | 'masterbate', 856 | 'master bates', 857 | 'masterbates', 858 | 'mastrabator', 859 | 'masturbate', 860 | 'masturbating', 861 | 'mattressprincess', 862 | 'mcfagget', 863 | 'meatbeater', 864 | 'meatrack', 865 | 'mgger', 866 | 'mggor', 867 | 'milf', 868 | 'minge', 869 | 'mofo', 870 | 'molest', 871 | 'molestation', 872 | 'molester', 873 | 'molestor', 874 | 'moneyshot', 875 | 'mooncricket', 876 | 'moron', 877 | 'mothafuck', 878 | 'mothafucka', 879 | 'mothafuckaz', 880 | 'mothafucked', 881 | 'mothafucker', 882 | 'motha fucker', 883 | 'mothafuckin', 884 | 'mothafucking', 885 | 'mothafuckings', 886 | 'motha fuker', 887 | 'motha fukkah', 888 | 'motha fukker', 889 | 'motherfuck', 890 | 'motherfucked', 891 | 'mother-fucker', 892 | 'motherfucker', 893 | 'mother fucker', 894 | 'motherfuckin', 895 | 'motherfucking', 896 | 'motherfuckings', 897 | 'mother fukah', 898 | 'mother fuker', 899 | 'mother fukkah', 900 | 'mother fukker', 901 | 'motherlovebone', 902 | 'muff', 903 | 'muffdive', 904 | 'muffdiver', 905 | 'muffindiver', 906 | 'mufflikcer', 907 | 'muncher', 908 | 'munging', 909 | 'muthafucker', 910 | 'mutha fucker', 911 | 'mutha fukah', 912 | 'mutha fuker', 913 | 'mutha fukkah', 914 | 'mutha fukker', 915 | 'nastt', 916 | 'nastybitch', 917 | 'nastyho', 918 | 'nastyslut', 919 | 'nastywhore', 920 | 'nazi', 921 | 'necro', 922 | 'negro', 923 | 'negroes', 924 | 'negroid', 925 | 'nigaboo', 926 | 'nigga', 927 | 'niggah', 928 | 'niggaracci', 929 | 'niggard', 930 | 'niggarded', 931 | 'niggarding', 932 | 'niggardliness', 933 | "niggardliness's", 934 | 'niggardly', 935 | "niggard's", 936 | 'niggards', 937 | 'niggaz', 938 | 'nigger', 939 | 'niggerhead', 940 | 'niggerhole', 941 | "nigger's", 942 | 'niggers', 943 | 'niggle', 944 | 'niggled', 945 | 'niggles', 946 | 'niggling', 947 | 'nigglings', 948 | 'niggor', 949 | 'niggur', 950 | 'niglet', 951 | 'nignog', 952 | 'nigr', 953 | 'nigra', 954 | 'nigre', 955 | 'nigur', 956 | 'niiger', 957 | 'niigr', 958 | 'nipple', 959 | 'nipplering', 960 | 'nittit', 961 | 'nlgger', 962 | 'nlggor', 963 | 'nofuckingway', 964 | 'nonce', 965 | 'nookey', 966 | 'nookie', 967 | 'nudger', 968 | 'nut case', 969 | 'nutcase', 970 | 'nutfucker', 971 | 'nut sack', 972 | 'nutsack', 973 | 'ontherag', 974 | 'orafis', 975 | 'orgasim', 976 | 'orgasim', 977 | 'orgasm', 978 | 'orgasum', 979 | 'orgies', 980 | 'orgy', 981 | 'oriface', 982 | 'orifice', 983 | 'orifiss', 984 | 'osama bin laden', 985 | 'packi', 986 | 'packie', 987 | 'packy', 988 | 'paedo', 989 | 'paedofile', 990 | 'paedophile', 991 | 'paki', 992 | 'pakie', 993 | 'paky', 994 | 'palesimian', 995 | 'panooch', 996 | 'panti', 997 | 'pearlnecklace', 998 | 'pecker', 999 | 'peckerhead', 1000 | 'peckerwood', 1001 | 'peedo', 1002 | 'peeenus', 1003 | 'peeenusss', 1004 | 'peehole', 1005 | 'peenus', 1006 | 'peinus', 1007 | 'penas', 1008 | 'penile', 1009 | 'penisbanger', 1010 | 'penis-breath', 1011 | 'penises', 1012 | 'penisfucker', 1013 | 'penispuffer', 1014 | 'penus', 1015 | 'penuus', 1016 | 'perv', 1017 | 'perversion', 1018 | 'pervert', 1019 | 'phonesex', 1020 | 'phuc', 1021 | 'phuck', 1022 | 'phuk', 1023 | 'phuked', 1024 | 'phuker', 1025 | 'phuking', 1026 | 'phukked', 1027 | 'phukker', 1028 | 'phukking', 1029 | 'phungky', 1030 | 'phuq', 1031 | 'pi55', 1032 | 'picaninny', 1033 | 'piccaninny', 1034 | 'pickaninny', 1035 | 'pikey', 1036 | 'piky', 1037 | 'pimper', 1038 | 'pimpjuic', 1039 | 'pimpjuice', 1040 | 'pimpsimp', 1041 | 'pindick', 1042 | 'piss', 1043 | 'pissed', 1044 | 'pissed off', 1045 | 'pisser', 1046 | 'pisses', 1047 | 'pissflaps', 1048 | 'pisshead', 1049 | 'pissin', 1050 | 'pissing', 1051 | 'pissoff', 1052 | 'play boy', 1053 | 'playboy', 1054 | 'play bunny', 1055 | 'playbunny', 1056 | 'play girl', 1057 | 'playgirl', 1058 | 'plumper', 1059 | 'pocketpool', 1060 | 'polac', 1061 | 'polack', 1062 | 'polak', 1063 | 'polesmoker', 1064 | 'pollock', 1065 | 'poon', 1066 | 'poonani', 1067 | 'poonany', 1068 | 'poontang', 1069 | 'pooperscooper', 1070 | 'pooping', 1071 | 'poorwhitetrash', 1072 | 'poostabber', 1073 | 'popimp', 1074 | 'porch monkey', 1075 | 'porchmonkey', 1076 | 'porn', 1077 | 'pornflick', 1078 | 'pornking', 1079 | 'porno', 1080 | 'pornprincess', 1081 | 'pric', 1082 | 'prick', 1083 | 'prik', 1084 | 'prickhead', 1085 | 'prostitute', 1086 | 'pu55i', 1087 | 'pu55y', 1088 | 'pube', 1089 | 'pubiclice', 1090 | 'puke', 1091 | 'punanny', 1092 | 'punta', 1093 | 'puntang', 1094 | 'purinaprincess', 1095 | 'pusse', 1096 | 'pussee', 1097 | 'pussie', 1098 | 'pussies', 1099 | 'pussy', 1100 | 'pussyeater', 1101 | 'pussyfucker', 1102 | 'pussylicker', 1103 | 'pussylicking', 1104 | 'pussylips', 1105 | 'pussylover', 1106 | 'pussypounder', 1107 | 'pusy', 1108 | 'puto', 1109 | 'puuke', 1110 | 'puuker', 1111 | 'queef', 1112 | 'queer', 1113 | 'queerbait', 1114 | 'queerhole', 1115 | 'queers', 1116 | 'queerz', 1117 | 'quim', 1118 | 'qweers', 1119 | 'qweerz', 1120 | 'qweir', 1121 | 'rag head', 1122 | 'raghead', 1123 | 'raped', 1124 | 'rapist', 1125 | 'rearend', 1126 | 'rearentry', 1127 | 'recktum', 1128 | 'rectum', 1129 | 'redneck', 1130 | 'renob', 1131 | 'rentafuck', 1132 | 'rimjob', 1133 | 'rimming', 1134 | 'ruski', 1135 | 'russki', 1136 | 'russkie', 1137 | 'sadist', 1138 | 'sadom', 1139 | 'saeema butt', 1140 | 'sandm', 1141 | 'sand nigger', 1142 | 'sandnigger', 1143 | 'scag', 1144 | 'scank', 1145 | 'scat', 1146 | 'schlong', 1147 | 'screwing', 1148 | 'screwyou', 1149 | 'scrote', 1150 | 'scrotum', 1151 | 'scum', 1152 | 'scumbag', 1153 | 'seaman staines', 1154 | 'semen', 1155 | 'sexed', 1156 | 'sexfarm', 1157 | 'sexhound', 1158 | 'sexhouse', 1159 | 'sexing', 1160 | 'sexkitten', 1161 | 'sexpot', 1162 | 'sexslave', 1163 | 'sextogo', 1164 | 'sextoy', 1165 | 'sextoys', 1166 | 'sexwhore', 1167 | 'sexymoma', 1168 | 'sexy-slim', 1169 | 'seymour butts', 1170 | 'shag', 1171 | 'shagger', 1172 | 'shaggin', 1173 | 'shagging', 1174 | 'shat', 1175 | 'shhit', 1176 | 'shit', 1177 | 'shitass', 1178 | 'shitbag', 1179 | 'shitbagger', 1180 | 'shitbrains', 1181 | 'shitbreath', 1182 | 'shitcan', 1183 | 'shitcanned', 1184 | 'shitcunt', 1185 | 'shitdick', 1186 | 'shite', 1187 | 'shiteater', 1188 | 'shited', 1189 | 'shiter', 1190 | 'shitface', 1191 | 'shitfaced', 1192 | 'shitfit', 1193 | 'shitforbrains', 1194 | 'shitfuck', 1195 | 'shitfucker', 1196 | 'shitfull', 1197 | 'shithapens', 1198 | 'shithappens', 1199 | 'shithead', 1200 | 'shithole', 1201 | 'shithouse', 1202 | 'shiting', 1203 | 'shitlist', 1204 | 'shitola', 1205 | 'shitoutofluck', 1206 | 'shits', 1207 | 'shitspitter', 1208 | 'shitstain', 1209 | 'shitted', 1210 | 'shitter', 1211 | 'shittiest', 1212 | 'shitting', 1213 | 'shitty', 1214 | 'shity', 1215 | 'shitz', 1216 | 'shiz', 1217 | 'shiznit', 1218 | 'shortfuck', 1219 | 'shyt', 1220 | 'shyte', 1221 | 'shytty', 1222 | 'shyty', 1223 | 'sissy', 1224 | 'sixsixsix', 1225 | 'sixtynine', 1226 | 'sixtyniner', 1227 | 'skanck', 1228 | 'skank', 1229 | 'skankbitch', 1230 | 'skankee', 1231 | 'skankey', 1232 | 'skankfuck', 1233 | 'skanks', 1234 | 'skankwhore', 1235 | 'skanky', 1236 | 'skankybitch', 1237 | 'skankywhore', 1238 | 'skeet', 1239 | 'skinflute', 1240 | 'skullfuck', 1241 | 'skum', 1242 | 'skumbag', 1243 | 'slanteye', 1244 | 'slantyeye', 1245 | 'slapper', 1246 | 'slavedriver', 1247 | 'sleezebag', 1248 | 'sleezeball', 1249 | 'slideitin', 1250 | 'slimeball', 1251 | 'slimebucket', 1252 | 'slopehead', 1253 | 'slopey', 1254 | 'slopy', 1255 | 'slut', 1256 | 'slutbag', 1257 | 'sluts', 1258 | 'slutt', 1259 | 'slutting', 1260 | 'slutty', 1261 | 'slutwear', 1262 | 'slutwhore', 1263 | 'slutz', 1264 | 'smackthemonkey', 1265 | 'smeg', 1266 | 'smelly', 1267 | 'smut', 1268 | 'snatch', 1269 | 'snatchpatch', 1270 | 'snot', 1271 | 'snowback', 1272 | 'snownigger', 1273 | 'sodom', 1274 | 'sodomise', 1275 | 'sodomite', 1276 | 'sodomize', 1277 | 'sodomy', 1278 | 'son-of-a-bitch', 1279 | 'sonofabitch', 1280 | 'sonofbitch', 1281 | 'spac', 1282 | 'spacca', 1283 | 'spaghettibender', 1284 | 'spaghettinigger', 1285 | 'spankthemonkey', 1286 | 'spazza', 1287 | 'sperm', 1288 | 'spermacide', 1289 | 'spermbag', 1290 | 'spermhearder', 1291 | 'spermherder', 1292 | 'spic', 1293 | 'spick', 1294 | 'spig', 1295 | 'spigotty', 1296 | 'spik', 1297 | 'spitter', 1298 | 'splittail', 1299 | 'splooge', 1300 | 'spooge', 1301 | 'spook', 1302 | 'spreadeagle', 1303 | 'squaw', 1304 | 'stabber', 1305 | 'stiffy', 1306 | 'strapon', 1307 | 'stripclub', 1308 | 'stroking', 1309 | 'stupidfuck', 1310 | 'stupidfucker', 1311 | 'suckass', 1312 | 'suckdick', 1313 | 'sucker', 1314 | 'suckme', 1315 | 'suckmyass', 1316 | 'suckmydick', 1317 | 'suckmytit', 1318 | 'suckoff', 1319 | 'swastika', 1320 | 'tampon', 1321 | 'tarbaby', 1322 | 'tard', 1323 | 'teat', 1324 | 'teste', 1325 | 'testicle', 1326 | 'testicles', 1327 | 'thicklips', 1328 | 'thicko', 1329 | 'thirdeye', 1330 | 'thirdleg', 1331 | 'threesome', 1332 | 'thundercunt', 1333 | 'timbernigger', 1334 | 'tit', 1335 | 'titbitnipply', 1336 | 'titfuck', 1337 | 'titfucker', 1338 | 'titfuckin', 1339 | 'titjob', 1340 | 'titlicker', 1341 | 'titlover', 1342 | 'tits', 1343 | 'tittie', 1344 | 'titties', 1345 | 'titty', 1346 | 'tittyfuck', 1347 | 'tonguethrust', 1348 | 'tonguethruster', 1349 | 'tonguetramp', 1350 | 'torture', 1351 | 'tosser', 1352 | 'tosspot', 1353 | 'towel head', 1354 | 'towelhead', 1355 | 'trailertrash', 1356 | 'tramp', 1357 | 'trannie', 1358 | 'tranny', 1359 | 'trots', 1360 | 'trouser snake', 1361 | 'tuckahoe', 1362 | 'tunneloflove', 1363 | 'turd', 1364 | 'twat', 1365 | 'twatlips', 1366 | 'twats', 1367 | 'twatwaffle', 1368 | 'twink', 1369 | 'twinkie', 1370 | 'twobitwhore', 1371 | 'unclefucker', 1372 | 'unfuckable', 1373 | 'upskirt', 1374 | 'uptheass', 1375 | 'upthebutt', 1376 | 'urinate', 1377 | 'urine', 1378 | 'usama bin laden', 1379 | 'uterus', 1380 | 'vag', 1381 | 'vagina', 1382 | 'vaginal', 1383 | 'vajayjay', 1384 | 'vajina', 1385 | 'va-j-j', 1386 | 'valjina', 1387 | 'vibrater', 1388 | 'vibrator', 1389 | 'vietcong', 1390 | 'violate', 1391 | 'violation', 1392 | 'virginbreaker', 1393 | 'vjayjay', 1394 | 'vomit', 1395 | 'vullva', 1396 | 'vulva', 1397 | 'wank', 1398 | 'wanker', 1399 | 'wanking', 1400 | 'wankjob', 1401 | 'waysted', 1402 | 'welcher', 1403 | 'wetback', 1404 | 'wetspot', 1405 | 'whacker', 1406 | 'whigger', 1407 | 'whiskeydick', 1408 | 'whiskydick', 1409 | 'whitenigger', 1410 | 'whitetrash', 1411 | 'whitey', 1412 | 'whoor', 1413 | 'whop', 1414 | 'whore', 1415 | 'whorebag', 1416 | 'whoreface', 1417 | 'whorefucker', 1418 | 'whorehouse', 1419 | 'wife beater', 1420 | 'williewanker', 1421 | 'wog', 1422 | 'wop', 1423 | 'wuss', 1424 | 'wuzzie', 1425 | 'x-rated', 1426 | 'xrated', 1427 | 'yellowman', 1428 | 'zigabo', 1429 | 'zipperhea', 1430 | 'zipper head', 1431 | ], 1432 | ]; -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Abstracts/StringNormalizer.php: -------------------------------------------------------------------------------- 1 | loadConfiguration($profanities, $falsePositives); 82 | 83 | $this->separatorExpression = $this->generateSeparatorExpression(); 84 | 85 | $this->characterExpressions = $this->generateSubstitutionExpression(); 86 | 87 | $this->generateProfanityExpressionArray(); 88 | } 89 | 90 | /** 91 | * Load Profanities, Separators and Substitutions 92 | * from config file or custom arrays. 93 | */ 94 | private function loadConfiguration(?array $customProfanities = null, ?array $customFalsePositives = null): void 95 | { 96 | // Set the profanities and false positives 97 | $this->profanities = $customProfanities ?? config('blasp.profanities'); 98 | $this->falsePositives = $customFalsePositives ?? config('blasp.false_positives'); 99 | 100 | $this->loadFromCacheOrGenerate(); 101 | } 102 | 103 | /** 104 | * Load configuration without using cache 105 | */ 106 | private function loadUncachedConfiguration(): void 107 | { 108 | $this->separators = config('blasp.separators'); 109 | $this->substitutions = config('blasp.substitutions'); 110 | 111 | // Generate expressions 112 | $this->separatorExpression = $this->generateSeparatorExpression(); 113 | $this->characterExpressions = $this->generateSubstitutionExpression(); 114 | $this->generateProfanityExpressionArray(); 115 | } 116 | 117 | /** 118 | * @return string 119 | */ 120 | private function generateSeparatorExpression(): string 121 | { 122 | // Get all separators except period 123 | $normalSeparators = array_filter($this->separators, function($sep) { 124 | return $sep !== '.'; 125 | }); 126 | 127 | // Create the pattern for normal separators 128 | $pattern = $this->generateEscapedExpression($normalSeparators, $this->escapedSeparatorCharacters); 129 | 130 | // Add period and 's' as optional characters that must be followed by a word character 131 | return '(?:' . $pattern . '|\.(?=\w)|(?:\s))*?'; 132 | } 133 | 134 | /** 135 | * @return array 136 | */ 137 | private function generateSubstitutionExpression(): array 138 | { 139 | $characterExpressions = []; 140 | 141 | foreach ($this->substitutions as $character => $substitutions) { 142 | 143 | $characterExpressions[$character] = $this->generateEscapedExpression($substitutions, [], '+') . self::SEPARATOR_PLACEHOLDER; 144 | } 145 | 146 | return $characterExpressions; 147 | } 148 | 149 | /** 150 | * @param array $characters 151 | * @param array $escapedCharacters 152 | * @param string $quantifier 153 | * @return string 154 | */ 155 | private function generateEscapedExpression(array $characters = [], array $escapedCharacters = [], string $quantifier = '*?'): string 156 | { 157 | $regex = $escapedCharacters; 158 | 159 | foreach ($characters as $character) { 160 | 161 | $regex[] = preg_quote($character, '/'); 162 | } 163 | 164 | return '[' . implode('', $regex) . ']' . $quantifier; 165 | } 166 | 167 | /** 168 | * Generate expressions foreach of the profanities 169 | * and order the array longest to shortest. 170 | * 171 | */ 172 | private function generateProfanityExpressionArray(): void 173 | { 174 | $profanityCount = count($this->profanities); 175 | 176 | for ($i = 0; $i < $profanityCount; $i++) { 177 | 178 | $this->profanityExpressions[$this->profanities[$i]] = $this->generateProfanityExpression($this->profanities[$i]); 179 | } 180 | } 181 | 182 | /** 183 | * Generate a regex expression foreach profanity. 184 | * 185 | * @param $profanity 186 | * @return string 187 | */ 188 | private function generateProfanityExpression($profanity): string 189 | { 190 | $expression = preg_replace(array_keys($this->characterExpressions), array_values($this->characterExpressions), $profanity); 191 | 192 | $expression = str_replace(self::SEPARATOR_PLACEHOLDER, $this->separatorExpression, $expression); 193 | 194 | // Allow for non-word characters or spaces around the profanity 195 | $expression = '/' . $expression . '/i'; 196 | 197 | return $expression; 198 | } 199 | } -------------------------------------------------------------------------------- /src/BlaspService.php: -------------------------------------------------------------------------------- 1 | profanityDetector = new ProfanityDetector($this->profanityExpressions, $this->falsePositives); 78 | 79 | $this->stringNormalizer = Normalize::getLanguageNormalizerInstance(); 80 | } 81 | 82 | /** 83 | * Configure the profanities and false positives. 84 | * 85 | * @param array|null $profanities 86 | * @param array|null $falsePositives 87 | * @return self 88 | */ 89 | public function configure(?array $profanities = null, ?array $falsePositives = null): self 90 | { 91 | $blasp = new BlaspService($profanities, $falsePositives); 92 | 93 | return $blasp; 94 | } 95 | 96 | /** 97 | * @param string $string 98 | * @return $this 99 | * @throws Exception 100 | */ 101 | public function check(string $string): self 102 | { 103 | if (empty($string)) { 104 | 105 | throw new Exception('No string to check'); 106 | } 107 | 108 | $this->sourceString = $string; 109 | 110 | $this->cleanString = $string; 111 | 112 | $this->handle(); 113 | 114 | return $this; 115 | } 116 | 117 | /** 118 | * Check if the incoming string contains any profanities, set property 119 | * values and mask the profanities within the incoming string. 120 | * 121 | * @return $this 122 | */ 123 | private function handle(): self 124 | { 125 | $continue = true; 126 | 127 | $stringToNormalize = $this->cleanString; 128 | $normalizedString = $this->stringNormalizer->normalize($stringToNormalize); 129 | 130 | // Loop through until no more profanities are detected 131 | while ($continue) { 132 | $continue = false; 133 | $normalizedString = preg_replace('/\s+/', ' ', $normalizedString); 134 | foreach ($this->profanityDetector->getProfanityExpressions() as $profanity => $expression) { 135 | preg_match_all($expression, $normalizedString, $matches, PREG_OFFSET_CAPTURE); 136 | 137 | if (!empty($matches[0])) { 138 | foreach ($matches[0] as $match) { 139 | // Get the start and length of the match 140 | $start = $match[1]; 141 | $length = strlen($match[0]); 142 | 143 | // Use boundaries to extract the full word around the match 144 | $fullWord = $this->getFullWordContext($normalizedString, $start, $length); 145 | 146 | // Check if the full word (in lowercase) is in the false positives list 147 | if ($this->profanityDetector->isFalsePositive($fullWord)) { 148 | continue; // Skip checking this word if it's a false positive 149 | } 150 | 151 | $continue = true; // Continue if we find any profanities 152 | 153 | $this->hasProfanity = true; 154 | 155 | // Replace the found profanity 156 | $this->generateProfanityReplacement((array) $match); 157 | 158 | $normalizedString = substr_replace($normalizedString, str_repeat('*', $length), $start, $length); 159 | 160 | // Avoid adding duplicates to the unique list 161 | if (!in_array($profanity, $this->uniqueProfanitiesFound)) { 162 | $this->uniqueProfanitiesFound[] = $profanity; 163 | } 164 | } 165 | } 166 | } 167 | } 168 | 169 | return $this; 170 | } 171 | 172 | /** 173 | * Mask the profanities found in the incoming string. 174 | * 175 | * @param array $match 176 | * @return void 177 | */ 178 | private function generateProfanityReplacement(array $match): void 179 | { 180 | $start = $match[1]; // Starting position of the profanity 181 | $length = mb_strlen($match[0], 'UTF-8'); // Length of the profanity 182 | $replacement = str_repeat("*", $length); // Mask with asterisks 183 | 184 | // Replace only the profanity in the cleanString, preserving the original case and spaces 185 | $this->cleanString = mb_substr($this->cleanString, 0, $start) . $replacement . 186 | mb_substr($this->cleanString, $start + $length); 187 | 188 | // Increment profanity count 189 | $this->profanitiesCount++; 190 | } 191 | 192 | /** 193 | * Get the full word context surrounding the matched profanity. 194 | * 195 | * @param string $string 196 | * @param int $start 197 | * @param int $length 198 | * @return string 199 | */ 200 | private function getFullWordContext(string $string, int $start, int $length): string 201 | { 202 | // Define word boundaries (spaces, punctuation, etc.) 203 | $left = $start; 204 | $right = $start + $length; 205 | 206 | // Move the left pointer backwards to find the start of the full word 207 | while ($left > 0 && preg_match('/\w/', $string[$left - 1])) { 208 | $left--; 209 | } 210 | 211 | // Move the right pointer forwards to find the end of the full word 212 | while ($right < strlen($string) && preg_match('/\w/', $string[$right])) { 213 | $right++; 214 | } 215 | 216 | // Return the full word surrounding the matched profanity 217 | return substr($string, $left, $right - $left); 218 | } 219 | 220 | 221 | /** 222 | * Get the incoming string. 223 | * 224 | * @return string 225 | */ 226 | public function getSourceString(): string 227 | { 228 | return $this->sourceString; 229 | } 230 | 231 | /** 232 | * Get the clean string with profanities masked. 233 | * 234 | * @return string 235 | */ 236 | public function getCleanString(): string 237 | { 238 | return $this->cleanString; 239 | } 240 | 241 | /** 242 | * Get a boolean value indicating if the incoming 243 | * string contains any profanities. 244 | * 245 | * @return bool 246 | */ 247 | public function hasProfanity(): bool 248 | { 249 | return $this->hasProfanity; 250 | } 251 | 252 | /** 253 | * Get the number of profanities found in the incoming string. 254 | * 255 | * @return int 256 | */ 257 | public function getProfanitiesCount(): int 258 | { 259 | return $this->profanitiesCount; 260 | } 261 | 262 | /** 263 | * Get the unique profanities found in the incoming string. 264 | * 265 | * @return array 266 | */ 267 | public function getUniqueProfanitiesFound(): array 268 | { 269 | return $this->uniqueProfanitiesFound; 270 | } 271 | } -------------------------------------------------------------------------------- /src/Console/Commands/BlaspClearCommand.php: -------------------------------------------------------------------------------- 1 | info('Blasp cache cleared successfully!'); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Facades/Blasp.php: -------------------------------------------------------------------------------- 1 | replaceSpecialChars($string); 13 | } 14 | 15 | /** 16 | * @param string $string 17 | * @return string 18 | */ 19 | private function replaceSpecialChars(string $string): string 20 | { 21 | $substitution = config('blasp.substitutions'); 22 | foreach ($substitution as $replacementWithSlashes => $chars) { 23 | $replacement = trim($replacementWithSlashes, '/'); 24 | $pattern = '/\b[' . implode('', array_map('preg_quote', $chars)) . ']\b/u'; 25 | $string = preg_replace($pattern, $replacement, $string); 26 | } 27 | return $string; 28 | } 29 | } -------------------------------------------------------------------------------- /src/Normalizers/Normalize.php: -------------------------------------------------------------------------------- 1 | profanityExpressions = $profanityExpressions; 25 | 26 | $this->falsePositives = $falsePositives; 27 | } 28 | 29 | /** 30 | * Return an array containing all profanities, substitutions 31 | * and separator variants. 32 | * 33 | * @return array 34 | */ 35 | public function getProfanityExpressions(): array 36 | { 37 | uksort($this->profanityExpressions, function($a, $b) { 38 | return strlen($b) - strlen($a); // Sort by length, descending 39 | }); 40 | 41 | return $this->profanityExpressions; 42 | } 43 | 44 | /** 45 | * Determine if an expression is a false positive 46 | * 47 | * @param string $word 48 | * @return bool 49 | */ 50 | public function isFalsePositive(string $word): bool 51 | { 52 | return in_array(strtolower($word), $this->falsePositives, true); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->runningInConsole()) { 15 | $this->publishes([ 16 | __DIR__.'/../config/config.php' => config_path('blasp.php'), 17 | ], 'blasp-config'); 18 | $this->commands([ 19 | Console\Commands\BlaspClearCommand::class, 20 | ]); 21 | } 22 | 23 | app('validator')->extend('blasp_check', function($attribute, $value, $parameters, $validator) { 24 | $language = $parameters[0] ?? null; 25 | 26 | $blaspService = new BlaspService($language); 27 | 28 | return !$blaspService->check($value)->hasProfanity(); 29 | }, 'The :attribute contains profanity.'); 30 | } 31 | 32 | /** 33 | * Register the application services. 34 | */ 35 | public function register() 36 | { 37 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'blasp'); 38 | 39 | $this->app->bind('blasp', function () { 40 | return new BlaspService(); 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Traits/BlaspCache.php: -------------------------------------------------------------------------------- 1 | generateCacheKey(); 23 | 24 | $cached = cache()->get($cacheKey); 25 | if ($cached) { 26 | $this->loadFromCache($cached); 27 | return; 28 | } 29 | 30 | $this->loadUncachedConfiguration(); 31 | $this->cacheConfiguration($cacheKey); 32 | } 33 | 34 | /** 35 | * Generate a unique cache key based on the content 36 | */ 37 | private function generateCacheKey(): string 38 | { 39 | $contentHash = md5(json_encode([ 40 | 'profanities' => $this->profanities, 41 | 'falsePositives' => $this->falsePositives, 42 | ])); 43 | 44 | return self::CACHE_KEY_PREFIX . $contentHash; 45 | } 46 | 47 | /** 48 | * Cache the current configuration 49 | */ 50 | private function cacheConfiguration(string $cacheKey): void 51 | { 52 | $configToCache = [ 53 | 'profanities' => $this->profanities, 54 | 'separators' => $this->separators, 55 | 'substitutions' => $this->substitutions, 56 | 'falsePositives' => $this->falsePositives, 57 | 'profanityExpressions' => $this->profanityExpressions, 58 | 'separatorExpression' => $this->separatorExpression, 59 | 'characterExpressions' => $this->characterExpressions, 60 | ]; 61 | 62 | cache()->put($cacheKey, $configToCache, self::CACHE_TTL); 63 | $this->trackCacheKey($cacheKey); 64 | } 65 | 66 | /** 67 | * Load configuration from cache 68 | */ 69 | private function loadFromCache(array $cached): void 70 | { 71 | $this->profanities = $cached['profanities']; 72 | $this->separators = $cached['separators']; 73 | $this->substitutions = $cached['substitutions']; 74 | $this->falsePositives = $cached['falsePositives']; 75 | $this->profanityExpressions = $cached['profanityExpressions']; 76 | $this->separatorExpression = $cached['separatorExpression']; 77 | $this->characterExpressions = $cached['characterExpressions']; 78 | } 79 | 80 | /** 81 | * Track cache key for later cleanup 82 | */ 83 | private function trackCacheKey(string $cacheKey): void 84 | { 85 | $cache = cache(); 86 | $keys = $cache->get('blasp_cache_keys', []); 87 | 88 | if (!in_array($cacheKey, $keys)) { 89 | $keys[] = $cacheKey; 90 | $cache->put('blasp_cache_keys', $keys, self::CACHE_TTL); 91 | } 92 | } 93 | 94 | /** 95 | * Clear all Blasp caches 96 | */ 97 | public static function clearCache(): void 98 | { 99 | $cache = cache(); 100 | 101 | $keys = $cache->get('blasp_cache_keys', []); 102 | foreach ($keys as $key) { 103 | $cache->forget($key); 104 | } 105 | 106 | $cache->forget('blasp_cache_keys'); 107 | } 108 | } -------------------------------------------------------------------------------- /tests/BlaspCheckTest.php: -------------------------------------------------------------------------------- 1 | blaspService = new BlaspService(); 16 | } 17 | 18 | /** 19 | * @throws Exception 20 | */ 21 | public function test_real_blasp_service() 22 | { 23 | $result = $this->blaspService->check('This is a fuck!ng sentence'); 24 | 25 | $this->assertTrue($result->hasProfanity); 26 | } 27 | 28 | /** 29 | * @throws Exception 30 | */ 31 | public function test_straight_match() 32 | { 33 | $result = $this->blaspService->check('This is a fucking sentence'); 34 | 35 | $this->assertTrue($result->hasProfanity); 36 | $this->assertSame(1, $result->profanitiesCount); 37 | $this->assertCount(1, $result->uniqueProfanitiesFound); 38 | $this->assertSame('This is a ******* sentence', $result->cleanString); 39 | } 40 | 41 | /** 42 | * @throws Exception 43 | */ 44 | public function test_substitution_match() 45 | { 46 | $result = $this->blaspService->check('This is a fÛck!ng sentence'); 47 | 48 | $this->assertTrue($result->hasProfanity); 49 | $this->assertSame(1, $result->profanitiesCount); 50 | $this->assertCount(1, $result->uniqueProfanitiesFound); 51 | $this->assertSame('This is a ******* sentence', $result->cleanString); 52 | } 53 | 54 | /** 55 | * @throws Exception 56 | */ 57 | public function test_obscured_match() 58 | { 59 | $result = $this->blaspService->check('This is a f-u-c-k-i-n-g sentence'); 60 | 61 | $this->assertTrue($result->hasProfanity); 62 | $this->assertSame(1, $result->profanitiesCount); 63 | $this->assertCount(1, $result->uniqueProfanitiesFound); 64 | $this->assertSame('This is a ************* sentence', $result->cleanString); 65 | } 66 | 67 | /** 68 | * @throws Exception 69 | */ 70 | public function test_doubled_match() 71 | { 72 | $result = $this->blaspService->check('This is a ffuucckkiinngg sentence'); 73 | 74 | $this->assertTrue($result->hasProfanity); 75 | $this->assertSame(1, $result->profanitiesCount); 76 | $this->assertCount(1, $result->uniqueProfanitiesFound); 77 | $this->assertSame('This is a ************** sentence', $result->cleanString); 78 | } 79 | 80 | /** 81 | * @throws Exception 82 | */ 83 | public function test_combination_match() 84 | { 85 | $result = $this->blaspService->check('This is a f-uuck!ng sentence'); 86 | 87 | $this->assertTrue($result->hasProfanity); 88 | $this->assertSame(1, $result->profanitiesCount); 89 | $this->assertCount(1, $result->uniqueProfanitiesFound); 90 | $this->assertSame('This is a ********* sentence', $result->cleanString); 91 | } 92 | 93 | /** 94 | * @throws Exception 95 | */ 96 | public function test_multiple_profanities_no_spaces() 97 | { 98 | $result = $this->blaspService->check('cuntfuck shit'); 99 | 100 | $this->assertTrue($result->hasProfanity); 101 | $this->assertSame(3, $result->profanitiesCount); 102 | $this->assertCount(3, $result->uniqueProfanitiesFound); 103 | $this->assertSame('******** ****', $result->cleanString); 104 | } 105 | 106 | /** 107 | * @throws Exception 108 | */ 109 | public function test_multiple_profanities() 110 | { 111 | $result = $this->blaspService->check('This is a fuuckking sentence you fucking cunt!'); 112 | $this->assertTrue($result->hasProfanity); 113 | $this->assertSame(3, $result->profanitiesCount); 114 | $this->assertCount(2, $result->uniqueProfanitiesFound); 115 | $this->assertSame('This is a ********* sentence you ******* ****!', $result->cleanString); 116 | } 117 | 118 | /** 119 | * @throws Exception 120 | */ 121 | public function test_scunthorpe_problem() 122 | { 123 | $result = $this->blaspService->check('I live in a town called Scunthorpe'); 124 | 125 | $this->assertTrue(!$result->hasProfanity); 126 | $this->assertSame(0, $result->profanitiesCount); 127 | $this->assertCount(0, $result->uniqueProfanitiesFound); 128 | $this->assertSame('I live in a town called Scunthorpe', $result->cleanString); 129 | } 130 | 131 | /** 132 | * @throws Exception 133 | */ 134 | public function test_penistone_problem() 135 | { 136 | $result = $this->blaspService->check('I live in a town called Penistone'); 137 | 138 | $this->assertTrue(!$result->hasProfanity); 139 | $this->assertSame(0, $result->profanitiesCount); 140 | $this->assertCount(0, $result->uniqueProfanitiesFound); 141 | $this->assertSame('I live in a town called Penistone', $result->cleanString); 142 | } 143 | 144 | /** 145 | * @throws Exception 146 | */ 147 | public function test_false_positives() 148 | { 149 | $words = [ 150 | 'Blackcocktail', 151 | 'Scunthorpe', 152 | 'Cockburn', 153 | 'Penistone', 154 | 'Lightwater', 155 | 'Assume', 156 | 'Bass', 157 | 'Class', 158 | 'Compass', 159 | 'Pass', 160 | 'Dickinson', 161 | 'Middlesex', 162 | 'Cockerel', 163 | 'Butterscotch', 164 | 'Blackcock', 165 | 'Countryside', 166 | 'Arsenal', 167 | 'Flick', 168 | 'Flicker', 169 | 'Analyst', 170 | ]; 171 | 172 | foreach ($words as $word) { 173 | 174 | $result = $this->blaspService->check($word); 175 | 176 | try { 177 | $this->assertTrue(!$result->hasProfanity); 178 | $this->assertSame(0, $result->profanitiesCount); 179 | $this->assertCount(0, $result->uniqueProfanitiesFound); 180 | $this->assertSame($word, $result->cleanString); 181 | } catch (\Exception $e) { 182 | dd($result); 183 | } 184 | } 185 | } 186 | 187 | /** 188 | * @throws Exception 189 | */ 190 | public function test_cuntfuck_fuckcunt() 191 | { 192 | $result = $this->blaspService->check('cuntfuck fuckcunt'); 193 | $this->assertTrue($result->hasProfanity); 194 | $this->assertSame(4, $result->profanitiesCount); 195 | $this->assertCount(2, $result->uniqueProfanitiesFound); 196 | $this->assertSame('******** ********', $result->cleanString); 197 | } 198 | 199 | /** 200 | * @throws Exception 201 | */ 202 | public function test_fucking_shit_cunt_fuck() 203 | { 204 | $result = $this->blaspService->check('fuckingshitcuntfuck'); 205 | $this->assertTrue($result->hasProfanity); 206 | $this->assertSame(3, $result->profanitiesCount); 207 | $this->assertCount(3, $result->uniqueProfanitiesFound); 208 | $this->assertSame('*******************', $result->cleanString); 209 | } 210 | 211 | /** 212 | * @throws Exception 213 | */ 214 | public function test_billy_butcher() 215 | { 216 | $result = $this->blaspService->check('oi! cunt!'); 217 | $this->assertTrue($result->hasProfanity); 218 | $this->assertSame(1, $result->profanitiesCount); 219 | $this->assertCount(1, $result->uniqueProfanitiesFound); 220 | $this->assertSame('oi! ****!', $result->cleanString); 221 | } 222 | 223 | /** 224 | * @throws Exception 225 | */ 226 | public function test_paragraph() 227 | { 228 | $paragraph = "This damn project is such a pain in the ass. I can't believe I have to deal with this bullshit every single day. It's like everything is completely fucked up, and nobody gives a shit. Sometimes I just want to scream, 'What the hell is going on?' Honestly, it's a total clusterfuck, and I'm so fucking done with this crap."; 229 | 230 | $result = $this->blaspService->check($paragraph); 231 | 232 | $expectedOutcome = "This **** project is such a pain in the ***. I can't believe I have to deal with this ******** every single day. It's like everything is completely ****** up, and nobody gives a ****. Sometimes I just want to scream, 'What the **** is going on?' Honestly, it's a total ***********, and I'm so ******* done with this ****."; 233 | 234 | $this->assertTrue($result->hasProfanity); 235 | $this->assertSame(9, $result->profanitiesCount); 236 | $this->assertCount(9, $result->uniqueProfanitiesFound); 237 | $this->assertSame($expectedOutcome, $result->cleanString); 238 | } 239 | 240 | public function test_word_boudary() 241 | { 242 | $result = $this->blaspService->check('afuckb'); 243 | $this->assertTrue($result->hasProfanity); 244 | $this->assertSame(1, $result->profanitiesCount); 245 | $this->assertCount(1, $result->uniqueProfanitiesFound); 246 | $this->assertSame('a****b', $result->cleanString); 247 | } 248 | 249 | public function test_pural_profanity() 250 | { 251 | $result = $this->blaspService->check('fuckings'); 252 | $this->assertTrue($result->hasProfanity); 253 | $this->assertSame(1, $result->profanitiesCount); 254 | $this->assertCount(1, $result->uniqueProfanitiesFound); 255 | $this->assertSame('*******s', $result->cleanString); 256 | } 257 | 258 | public function test_this_musicals_hit() 259 | { 260 | $result = $this->blaspService->check('This musicals hit'); 261 | $this->assertTrue(!$result->hasProfanity); 262 | $this->assertSame(0, $result->profanitiesCount); 263 | $this->assertCount(0, $result->uniqueProfanitiesFound); 264 | $this->assertSame('This musicals hit', $result->cleanString); 265 | } 266 | 267 | public function test_ass_subtitution() 268 | { 269 | $result = $this->blaspService->check('a$$'); 270 | $this->assertTrue($result->hasProfanity); 271 | $this->assertSame(1, $result->profanitiesCount); 272 | $this->assertCount(1, $result->uniqueProfanitiesFound); 273 | $this->assertSame('***', $result->cleanString); 274 | } 275 | 276 | public function test_embedded_profanities() 277 | { 278 | $result = $this->blaspService->check('abcdtwatefghshitijklmfuckeropqrccuunntt'); 279 | $this->assertTrue($result->hasProfanity); 280 | $this->assertSame(4, $result->profanitiesCount); 281 | $this->assertCount(4, $result->uniqueProfanitiesFound); 282 | $this->assertSame('abcd****efgh****ijklm******opqr********', $result->cleanString); 283 | } 284 | } -------------------------------------------------------------------------------- /tests/BlaspCheckValidationTest.php: -------------------------------------------------------------------------------- 1 | 'This is a clean message.']; 16 | 17 | $rules = ['message' => 'blasp_check']; 18 | 19 | $validator = Validator::make($data, $rules); 20 | 21 | $this->assertTrue($validator->passes()); 22 | } 23 | 24 | /** 25 | * Test validation fails with profane text. 26 | * 27 | * @return void 28 | */ 29 | public function test_blasp_check_validation_fails_with_profanity() 30 | { 31 | $data = ['message' => 'This is a fucking message.']; 32 | 33 | $rules = ['message' => 'blasp_check']; 34 | 35 | $validator = Validator::make($data, $rules); 36 | 37 | $this->assertTrue($validator->fails()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 |