Skip to content

Commit 6bef871

Browse files
deemonicclaude
andcommitted
fix: add common English words to false positives list (#32)
Words like "assignment", "passion", "classroom", "passenger" were falsely flagged because they contain the substring "ass". Expanded the false_positives list with ~200 common English words containing profanity substrings (ass, tit, cum, nig, rap, nob). Closes #32 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dffff5b commit 6bef871

File tree

2 files changed

+283
-0
lines changed

2 files changed

+283
-0
lines changed

config/languages/english.php

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,247 @@
13231323
'is hit',
13241324
'blackcocktail',
13251325
'its not',
1326+
// Common words containing "ass"
1327+
'assignment',
1328+
'assign',
1329+
'assigned',
1330+
'assigns',
1331+
'assigning',
1332+
'assist',
1333+
'assistant',
1334+
'assisted',
1335+
'assists',
1336+
'assistance',
1337+
'associate',
1338+
'associated',
1339+
'associates',
1340+
'association',
1341+
'associations',
1342+
'assemble',
1343+
'assembled',
1344+
'assembles',
1345+
'assembly',
1346+
'assert',
1347+
'asserted',
1348+
'assertion',
1349+
'assertions',
1350+
'asserts',
1351+
'assess',
1352+
'assessed',
1353+
'assesses',
1354+
'assessing',
1355+
'assessment',
1356+
'assessments',
1357+
'asset',
1358+
'assets',
1359+
'assure',
1360+
'assured',
1361+
'assures',
1362+
'assurance',
1363+
'assorted',
1364+
'assortment',
1365+
'assassin',
1366+
'assassins',
1367+
'assassination',
1368+
'assassinated',
1369+
'assault',
1370+
'assaulted',
1371+
'assaults',
1372+
'passion',
1373+
'passionate',
1374+
'passions',
1375+
'passive',
1376+
'passively',
1377+
'passenger',
1378+
'passengers',
1379+
'passage',
1380+
'passages',
1381+
'passing',
1382+
'passed',
1383+
'passes',
1384+
'passport',
1385+
'passports',
1386+
'password',
1387+
'passwords',
1388+
'bypass',
1389+
'bypassed',
1390+
'bypasses',
1391+
'bypassing',
1392+
'classroom',
1393+
'classrooms',
1394+
'classic',
1395+
'classical',
1396+
'classics',
1397+
'classification',
1398+
'classifications',
1399+
'classified',
1400+
'classify',
1401+
'classmate',
1402+
'classmates',
1403+
'classed',
1404+
'classes',
1405+
'classy',
1406+
'mass',
1407+
'masses',
1408+
'massive',
1409+
'massively',
1410+
'massage',
1411+
'massages',
1412+
'massacre',
1413+
'massacres',
1414+
'embassy',
1415+
'embassies',
1416+
'ambassador',
1417+
'ambassadors',
1418+
'embarrass',
1419+
'embarrassed',
1420+
'embarrassing',
1421+
'embarrassment',
1422+
'harass',
1423+
'harassed',
1424+
'harassing',
1425+
'harassment',
1426+
'brass',
1427+
'brassy',
1428+
'crass',
1429+
'glass',
1430+
'glasses',
1431+
'glassy',
1432+
'grass',
1433+
'grasses',
1434+
'grassy',
1435+
'lass',
1436+
'lassie',
1437+
'molasses',
1438+
'morass',
1439+
'sass',
1440+
'sassy',
1441+
'trespass',
1442+
'trespassed',
1443+
'trespassing',
1444+
'surpass',
1445+
'surpassed',
1446+
'surpasses',
1447+
'compassion',
1448+
'compassionate',
1449+
'encompass',
1450+
'encompassed',
1451+
'encompasses',
1452+
'encompassing',
1453+
// Common words containing "tit"
1454+
'title',
1455+
'titles',
1456+
'titled',
1457+
'subtitle',
1458+
'subtitles',
1459+
'entity',
1460+
'entities',
1461+
'identity',
1462+
'identities',
1463+
'quantity',
1464+
'quantities',
1465+
'constitution',
1466+
'constitutional',
1467+
'constitutions',
1468+
'constitute',
1469+
'constitutes',
1470+
'institution',
1471+
'institutional',
1472+
'institutions',
1473+
'petition',
1474+
'petitions',
1475+
'petitioner',
1476+
'competition',
1477+
'competitions',
1478+
'competitive',
1479+
'competitor',
1480+
'competitors',
1481+
'repetition',
1482+
'repetitions',
1483+
'repetitive',
1484+
'appetite',
1485+
'appetites',
1486+
'gratitude',
1487+
'attitude',
1488+
'attitudes',
1489+
'altitude',
1490+
'altitudes',
1491+
'aptitude',
1492+
'multitude',
1493+
'fortitude',
1494+
'latitude',
1495+
'latitudes',
1496+
'partition',
1497+
'partitions',
1498+
'practitioner',
1499+
'practitioners',
1500+
'restitution',
1501+
'prostitution',
1502+
'superstition',
1503+
'superstitions',
1504+
'superstitious',
1505+
'titillate',
1506+
'titan',
1507+
'titans',
1508+
'titanium',
1509+
// Common words containing "cum"
1510+
'document',
1511+
'documents',
1512+
'documentary',
1513+
'documentation',
1514+
'documented',
1515+
'circumstance',
1516+
'circumstances',
1517+
'circumference',
1518+
'accumulate',
1519+
'accumulated',
1520+
'accumulation',
1521+
'cucumber',
1522+
'cucumbers',
1523+
'incumbent',
1524+
'incumbents',
1525+
// Common words containing "ho" / "hoe"
1526+
'shoe',
1527+
'shoes',
1528+
'shoelace',
1529+
'horseshoe',
1530+
// Common words containing "nig"
1531+
'night',
1532+
'nights',
1533+
'nightclub',
1534+
'nightfall',
1535+
'nightlife',
1536+
'nightmare',
1537+
'nightmares',
1538+
'nightstand',
1539+
'nighttime',
1540+
'tonight',
1541+
'overnight',
1542+
'knight',
1543+
'knights',
1544+
// Common words containing "rap"
1545+
'grape',
1546+
'grapes',
1547+
'drape',
1548+
'drapes',
1549+
'scrape',
1550+
'scraped',
1551+
'scraper',
1552+
'therapy',
1553+
'therapies',
1554+
'therapist',
1555+
'therapists',
1556+
// Common words containing "nob"
1557+
'noble',
1558+
'nobles',
1559+
'nobleman',
1560+
'nobility',
1561+
'knob',
1562+
'knobs',
1563+
'snob',
1564+
'snobs',
1565+
'snobbish',
1566+
'snobby',
13261567
],
13271568

13281569
'substitutions' => [

tests/Issue32FalsePositiveTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Blaspsoft\Blasp\Tests;
4+
5+
use Blaspsoft\Blasp\Facades\Blasp;
6+
7+
class Issue32FalsePositiveTest extends TestCase
8+
{
9+
/**
10+
* @dataProvider legitimateWordsProvider
11+
*/
12+
public function test_legitimate_words_not_flagged(string $word)
13+
{
14+
$result = Blasp::check($word);
15+
$this->assertFalse(
16+
$result->hasProfanity(),
17+
"\"$word\" should not be flagged as profanity but got: " . implode(', ', $result->getUniqueProfanitiesFound())
18+
);
19+
}
20+
21+
public static function legitimateWordsProvider(): array
22+
{
23+
return [
24+
'assignment' => ['assignment'],
25+
'passion' => ['passion'],
26+
'classroom' => ['classroom'],
27+
'passenger' => ['passenger'],
28+
'assassin' => ['assassin'],
29+
'massive' => ['massive'],
30+
'embassy' => ['embassy'],
31+
'harassment' => ['harassment'],
32+
'compassion' => ['compassion'],
33+
'association' => ['association'],
34+
];
35+
}
36+
37+
public function test_actual_profanity_still_detected()
38+
{
39+
$result = Blasp::check('ass');
40+
$this->assertTrue($result->hasProfanity());
41+
}
42+
}

0 commit comments

Comments
 (0)