# ai-cliche-scanner

> Lightweight, zero-dependency AI cliché detector, throat-clearing opener remover, and prose naturalness scorer based on 14-million PubMed research patterns across 7 languages. Powering the [AI Cliché Scanner at WordCount Pulse](https://wordcountpulse.in/ai-cliche-scanner/).

[![npm version](https://img.shields.io/npm/v/ai-cliche-scanner.svg)](https://www.npmjs.com/package/ai-cliche-scanner)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/ai-cliche-scanner/badge)](https://www.jsdelivr.com/package/npm/ai-cliche-scanner)
[![Bundle Size](https://img.shields.io/bundlephobia/minzip/ai-cliche-scanner)](https://bundlephobia.com/package/ai-cliche-scanner)
[![Dependencies](https://img.shields.io/badge/dependencies-0-success.svg)](https://www.npmjs.com/package/ai-cliche-scanner)

> **Live Interactive Sandbox**: Try the visual scanner in your browser at [WordCount Pulse AI Cliché Scanner](https://wordcountpulse.in/ai-cliche-scanner/).

---

## Why Pattern-Based AI Detection?
Probabilistic neural classifiers frequently flag non-native English speakers and academic prose as AI-generated. `ai-cliche-scanner` takes a transparent, deterministic approach: it cross-references text against 3,250+ over-represented AI tokens and formulaic idioms identified from comparative post-2022 research manuscripts and LLM generation benchmarks.

### 4 Categorized Detection Tiers
1. **Dead Giveaways (Tier 1):** Unmistakable AI tokens (*delve*, *testament*, *tapestry*, *pivotal*, *beacon*, *myriad*, *realm*).
2. **Throat-Clearing Openers (Tier 2):** Empty preambles (*"In today's fast-paced digital world..."*, *"It is crucial to remember that..."*).
3. **Mechanical Transitions (Tier 3):** Formulaic connectors (*Moreover*, *Furthermore*, *In conclusion*, *It is worth noting*).
4. **Corporate Filler (Tier 4):** Empty synergy jargon (*streamline*, *revolutionize*, *leverage*, *paradigm shift*).

---

## Installation

```bash
npm install ai-cliche-scanner
# or
yarn add ai-cliche-scanner
# or
pnpm add ai-cliche-scanner
```

---

## Quickstart

### Node.js (ESM & CJS)

```typescript
import { 
  scanCliches, 
  calculateNaturalness, 
  humanizeText, 
  removeThroatClearing,
  TOP_AI_CLICHES 
} from 'ai-cliche-scanner';

const sampleText = `
In today's fast-paced digital world, it is crucial to remember that artificial intelligence 
plays a pivotal role. In this study, we delve into the intricate tapestry of neural networks. 
This stands as a testament to algorithmic progress.
`;

// 1. Scan for AI clichés and view categorization
const scan = scanCliches(sampleText);
console.log(scan.totalMatches);      // 4
console.log(scan.naturalnessScore);  // 18 (out of 100)
console.log(scan.grade);             // "Heavy AI Lexical Fingerprint"
console.log(scan.matches[0].phrase); // "in today's fast-paced digital world"

// 2. Direct naturalness score
const score = calculateNaturalness(sampleText);
console.log(`Naturalness: ${score}%`); // 18%

// 3. Strip formulaic throat-clearing intros
const trimmed = removeThroatClearing(sampleText);
console.log(trimmed);
// "Artificial intelligence plays a pivotal role. In this study, we delve into the intricate tapestry..."

// 4. Automated prose humanization with contextual inflections
const humanized = humanizeText(sampleText);
console.log(humanized.humanizedText);
// "Artificial intelligence is central. In this study, we explore the diverse mix of neural networks. This demonstrates algorithmic progress."
console.log(humanized.scoreAfter); // 100%

// 5. Inspect top cataloged AI buzzwords
console.log(TOP_AI_CLICHES.slice(0, 5));
// ['delve', 'delve into', 'tapestry', 'rich tapestry', 'testament']
```

### Browser ESM (via jsDelivr CDN)

```html
<script type="module">
  import { scanCliches, calculateNaturalness } from 'https://cdn.jsdelivr.net/npm/ai-cliche-scanner@1.0.1/dist/index.mjs';

  const result = scanCliches("We delve into this tapestry.");
  console.log(result.naturalnessScore); // 45
</script>
```

---

## Multilingual Support Across 7 Languages

`ai-cliche-scanner` includes native lexical dictionaries, verb inflections, and grammatical rules for all 7 languages supported by WordCount Pulse:

- **English (`en`):** [AI Cliché Scanner](https://wordcountpulse.in/ai-cliche-scanner/)
- **Spanish (`es`):** [Detector de Frases Hechas de IA](https://wordcountpulse.in/es/detector-frases-ia/)
- **Portuguese (`pt`):** [Detector de Clichês de IA](https://wordcountpulse.in/pt/detector-frases-ia/)
- **French (`fr`):** [Détecteur de Clichés IA](https://wordcountpulse.in/fr/detecteur-cliches-ia/)
- **German (`de`):** [KI-Phrasen-Prüfer & Text-Humanisierer](https://wordcountpulse.in/de/ai-phrasen-pruefer/)
- **Italian (`it`):** [Rilevatore di Frasi Fatte IA](https://wordcountpulse.in/it/frasi-fatte-ia/)
- **Japanese (`ja`):** [AI定型表現チェッカー (CJK境界解析)](https://wordcountpulse.in/ja/ai-cliche-checker/)

### Automatic Language Detection

```typescript
import { detectTextLocale, scanCliches } from 'ai-cliche-scanner';

const text = "Es crucial destacar la importancia de este enfoque holístico.";
const locale = detectTextLocale(text); // "es"
const results = scanCliches(text, locale);

console.log(results.matches[0].phrase); // "es crucial destacar"
```

---

## Live Companion Tools & Ecosystem

`ai-cliche-scanner` is part of the WordCount Pulse text intelligence suite:
- **Core Word & Character Counter:** [WordCount Pulse](https://wordcountpulse.in/)
- **7-Formula Readability Engine:** [Readability Checker](https://wordcountpulse.in/readability-checker/)
- **Academic Manuscript Formatter:** [Words to Pages](https://wordcountpulse.in/words-to-pages/)
- **Keynote Pacing & Speech Timing:** [Speech to Words](https://wordcountpulse.in/speech-to-words/)

---

## Research & Documentation
Read the empirical benchmark methodology and corpus analysis:
[WordCount Pulse Research: AI Clichés in Writing](https://wordcountpulse.in/blog/ai-cliches-in-writing/).

## License
MIT © [WordCount Pulse](https://wordcountpulse.in)
