{"id":15201606,"url":"https://github.com/voxpelli/activityspam-filter","last_synced_at":"2026-02-25T02:32:01.816Z","repository":{"id":181481846,"uuid":"666784667","full_name":"voxpelli/activityspam-filter","owner":"voxpelli","description":"Extracted from https://gitlab.com/evanp/activityspam","archived":false,"fork":false,"pushed_at":"2024-07-13T17:55:33.000Z","size":36,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-02T17:34:26.931Z","etag":null,"topics":["activitypub","activityspam","activitystreams","spam-filtering"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpelli.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":"2023-07-15T15:08:49.000Z","updated_at":"2023-07-15T20:26:25.000Z","dependencies_parsed_at":"2023-12-26T03:31:10.123Z","dependency_job_id":"79154681-3199-4523-be10-d8bdb171f442","html_url":"https://github.com/voxpelli/activityspam-filter","commit_stats":null,"previous_names":["voxpelli/activityspam-filter"],"tags_count":3,"template":false,"template_full_name":"voxpelli/node-module-template","purl":"pkg:github/voxpelli/activityspam-filter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Factivityspam-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Factivityspam-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Factivityspam-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Factivityspam-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpelli","download_url":"https://codeload.github.com/voxpelli/activityspam-filter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Factivityspam-filter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29809086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T22:43:48.403Z","status":"online","status_checked_at":"2026-02-25T02:00:07.329Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["activitypub","activityspam","activitystreams","spam-filtering"],"created_at":"2024-09-28T03:07:27.284Z","updated_at":"2026-02-25T02:32:01.786Z","avatar_url":"https://github.com/voxpelli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActivitySpam Filter\n\nExtraction and modernization of the filters in [activityspam](https://gitlab.com/evanp/activityspam) + a minimal databank reimplementation\n\n[![npm version](https://img.shields.io/npm/v/activityspam-filter.svg?style=flat)](https://www.npmjs.com/package/activityspam-filter)\n[![npm downloads](https://img.shields.io/npm/dm/activityspam-filter.svg?style=flat)](https://www.npmjs.com/package/activityspam-filter)\n[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/voxpelli/eslint-config)\n[![Module type: ESM](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)\n[![Types in JS](https://img.shields.io/badge/types_in_js-yes-brightgreen)](https://github.com/voxpelli/types-in-js)\n[![Follow @voxpelli@mastodon.social](https://img.shields.io/mastodon/follow/109247025527949675?domain=https%3A%2F%2Fmastodon.social\u0026style=social)](https://mastodon.social/@voxpelli)\n\n## Usage\n\n### Simple\n\n```javascript\nimport { SpamFilter, SimpleDatabankRedis } from 'activityspam-filter';\n\n// Configured like ioredis, so by default it will connect to localhost:6379\nconst redisDb = new SimpleDatabankRedis();\nconst filter = new SpamFilter(redisDb);\n\nawait filter.train('spam', foo);\nawait filter.train('ham', bar);\nconst { isSpam } = await filter.test(abc);\n```\n\n## `SpamFilter(db, [tokenizerOptions])`\n\n* **db** – a `SimpleDatabank` compatible class such as the supplied `SimpleDatabankRedis`\n\n## SpamFilter API\n\n### `train(category, data) =\u003e Promise\u003cSpamFilterTrainingResult\u003e`\n\n* **category** – should be either `spam` or `ham` depending on what kind of content to train it with\n* **data** – should be an `object` or an `array` of the data that should be tokenized and trained on\n\nReturns an `object` with properties:\n\n* **cat** – the supplied `category`\n* **object** – a stringified representation of the data that's been supplied\n* **date** – the ISO date this training data was created\n* **elapsed** – the amount of milliseconds the training took\n\n### `test(data) =\u003e Promise\u003cSpamFilterDecision\u003e`\n\n* **data** – should be an `object` or an `array` of the data that should be tokenized and tested\n\nReturns an `object` with properties:\n\n* **probability** – a number\n* **isSpam** – a boolean\n* **bestKeys** – a list of the best tokens\n* **elapsed** – the amount of milliseconds the check took\n\n## `SimpleDatabankRedis(ioRedisConfig)`\n\nConfigured like [ioredis](https://www.npmjs.com/package/ioredis) and provides a `SimpleDatabank` compatible implementation of that.\n\n## Types\n\n* `SimpleDatabank` – the structure of a [databank](https://www.npmjs.com/package/databank) style implementation\n\n## See also\n\n* [activityspam](https://gitlab.com/evanp/activityspam)\n* [databank](https://www.npmjs.com/package/databank)\n* [ioredis](https://www.npmjs.com/package/ioredis)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Factivityspam-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpelli%2Factivityspam-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Factivityspam-filter/lists"}