{"id":16812845,"url":"https://github.com/seiyria/censor-sensor","last_synced_at":"2025-07-04T17:32:17.399Z","repository":{"id":29578357,"uuid":"122092312","full_name":"seiyria/censor-sensor","owner":"seiyria","description":"a better profanity filter","archived":false,"fork":false,"pushed_at":"2023-03-22T14:53:54.000Z","size":51,"stargazers_count":16,"open_issues_count":7,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-26T10:54:52.609Z","etag":null,"topics":["censor","filter","profanity-filter","slurs"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seiyria.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-19T16:50:05.000Z","updated_at":"2024-07-23T13:07:12.000Z","dependencies_parsed_at":"2024-10-28T18:03:24.153Z","dependency_job_id":null,"html_url":"https://github.com/seiyria/censor-sensor","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.36,"last_synced_commit":"dbc95e131e2ab8197839504dbffab77dbba52d77"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/seiyria/censor-sensor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiyria%2Fcensor-sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiyria%2Fcensor-sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiyria%2Fcensor-sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiyria%2Fcensor-sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seiyria","download_url":"https://codeload.github.com/seiyria/censor-sensor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiyria%2Fcensor-sensor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263588274,"owners_count":23484895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["censor","filter","profanity-filter","slurs"],"created_at":"2024-10-13T10:23:40.009Z","updated_at":"2025-07-04T17:32:17.379Z","avatar_url":"https://github.com/seiyria.png","language":"TypeScript","readme":"# Censor Sensor\n\nA better profanity filter.\n\n# Why?\n\nEvery other profanity filter just seems to be an array of words, checked against every word in a phrase. This is ridiculous - it's an O(N^2) check when it only needs to be O(N). Of course, this library, by default, only requires an O(N) check (and that's against your phrase; not my words). You can opt in to a \"like\" check which will check every word and try to match it to a substring.\n\nEvery other profanity filter also seems to neglect \"tiers\" of words. You might want to filter out slurs, but not common profanity. You can do that here.\n\nIf you want, you can pass a function that lets you censor words how you want. By default, it will be replaced with the `*` character in quantity based on the word (so \"fuck\" translates to \"****\").\n\nThat said, this library only has a list for english (`en`), but could be extended to add more fairly easily.\n\nYou can remove or add words at run time. By default, they'll be assigned the lowest tier (5).\n\nWords are shamelessly based on [profanity-cleanser](https://github.com/LDNOOBW/profanity-cleanser), because I'm not creative enough to think of some of these.\n\n# Install\n\n`npm i censor-sensor`\n\n# Usage\n\n```js\nimport { CensorSensor } from 'censor-sensor';\n\nconst censor = new CensorSensor();\n\n// check for profanity (using equality)\ncensor.isProfane('bollocks'); // true\ncensor.isProfane('hello');    // false\n\n// check for profanity (using string.includes)\ncensor.isProfaneIsh('bollockshead') // true\ncensor.isProfaneIsh('hello')        // true\n\n// get the words that are profane from a phrase\ncensor.profaneIshWords('hello')     // ['hell']\n\n// clean profanity (using equality)\ncensor.cleanProfanity('bollocks')   // '****' (by default)\ncensor.cleanProfanityIsh('hello')   // '****o' (by default)\n\n// add a custom cleanup function\ncensor.setCleanFunction((str) =\u003e Array.from(str, x =\u003e '%').join('')); // replace all bad characters with '%'\ncensor.cleanProfanity('bollocks')   // '%%%%%%%%' (by default)\n\n// reset the cleanup function\ncensor.resetCleanFunction()\n\n// modify the banned words list\ncensor.isProfane('asdf')    // false\ncensor.addWord('asdf')\ncensor.isProfane('asdf')    // true\ncensor.removeWord('asdf')\ncensor.isProfane('asdf')    // false\n\n// modify the banned \"tier\"\ncensor.isProfane('bollocks')    // true\ncensor.disableTier(4)\ncensor.isProfane('bollocks')    // false \ncensor.enableTier(4);\ncensor.isProfane('bollocks')    // true\n\n// add a custom locale (dict) and use it\ncensor.isProfane('uwotm8')                // false\ncensor.addLocale('custom', { uwotm8: 1 }) // the highest form of insult\ncensor.setLocale('custom')\ncensor.isProfane('uwotm8')                // true\ncensor.setLocale('en')\ncensor.isProfane('uwotm8')                // false\n\n// remove an existing word from an existing tier\ncensor.isProfane('hell')  // true\ncensor.removeWord('hell')\ncensor.isProfane('hell')  // false\n```\n\n# Word Tiers\n\nAs stated before, every word has a tier associated with it. Here is what each tier number means:\n\n1. slurs\n2. common profanity\n3. sexual terms\n4. possibly offensive terms\n5. user-created terms\n\n# Contributing\n\nFeel free to contribute words, locales, or features.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseiyria%2Fcensor-sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseiyria%2Fcensor-sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseiyria%2Fcensor-sensor/lists"}