Socket
Book a DemoInstallSign in
Socket

spam-humanizer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spam-humanizer

A lightweight JavaScript library for normalizing obfuscated text and detecting spam across English, Russian, and Ukrainian languages using OpenAI or DeepSeek AI providers.

1.0.8
latest
npmnpm
Version published
Maintainers
1
Created
Source

spam-humanizer

A lightweight JavaScript library for normalizing obfuscated text and detecting spam across English, Russian, and Ukrainian languages using OpenAI or DeepSeek AI providers.

Features

  • Text Humanization: Convert garbled or obfuscated characters (e.g., ೧ⲢӤβεT) into readable text by mapping Unicode symbols to their Latin or Cyrillic equivalents.
  • Spam Detection: Leverage GPT-based models to classify whether a piece of text is spam or advertisement, with support for single-language or multi-language checks.
  • Flexible AI Providers: Choose between OpenAI and DeepSeek APIs with a unified interface.
  • Multi-Language Support: Built-in dictionaries for English (en.json), Russian (ru.json), and Ukrainian (ua.json).

Installation

npm install spam-humanizer

Quick Start

import { SpamHumanizer } from "spam-humanizer";

// Initialize with your API key and preferred provider
const humanizer = new SpamHumanizer({
  apiKey: process.env.OPENAI_KEY,
  provider: "openai"  // or "deepseek"
});

(async () => {
  // Humanize garbled text
  const readable = await humanizer.humanize("೧ⲢӤβεT", "ru");
  console.log(readable); // "Привет"

  // Spam detection (single language)
  const result = await humanizer.isSpam("Buy cheap Viagra now!", "en");
  console.log(result);
  // → { spam: true, lang: 'en', reason: 'yes: promotional content detected' }

  // Spam detection (multi-language fallback)
  const multiCheck = await humanizer.isSpam("Купи підписку вже зараз!");
  console.log(multiCheck);
  // → { spam: true, lang: 'ua', reason: 'yes: рекламний текст' }
})();

API Reference

new SpamHumanizer({ apiKey, provider })

  • `` (string, required): Your API key for the AI provider.
  • `` (string, optional): Either "openai" (default) or "deepseek".

.humanize(text, lang?)

Normalize obfuscated text:

  • `` (string, required): The input string to normalize.
  • `` ("en"|"ru"|"ua", optional): Primary language. Defaults to "en".

Returns a Promise<string> with the humanized text.

.isSpam(text, lang?)

Detects whether text is spam:

  • `` (string, required): The input to classify.
  • `` ("en"|"ru"|"ua", optional): If omitted, checks across all three languages.

Returns a Promise<Object>:

  • spam (boolean)
  • lang (string) – the language in which spam was detected
  • reason (string) – the raw model response

License

MIT © @radonl

Donate

BTC: bc1qzjjffns84rxcfg9hqd4se76p5k3f0y5urv4q52

ETH: 0x7c625921BF29337fB91231d0df78c88B97cA85a7

USDT(ETH): 0x7c625921BF29337fB91231d0df78c88B97cA85a7

FAQs

Package last updated on 05 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.