Skip to content

feat(humanizer): pondération par mode + profils multiples#3

Open
freemind25 wants to merge 1 commit into
mainfrom
feat/humanizer-mode-weighting-profiles
Open

feat(humanizer): pondération par mode + profils multiples#3
freemind25 wants to merge 1 commit into
mainfrom
feat/humanizer-mode-weighting-profiles

Conversation

@freemind25

Copy link
Copy Markdown
Owner

Résumé

Phase 0 de la feuille de route d'humanisation (voir échange avec Claude) :
pondération du score IA par mode de réécriture + persistance/multiplicité
des profils d'écriture.

Changements

  • textAnalysis.ts : nouveau type ScoreMode + table MODE_TOLERANCE.
    Un texte académique avec des connecteurs formels n'est plus pénalisé à
    tort ; il l'est davantage en mode Naturel/Personnel où l'oralité est
    attendue. Les sous-scores bruts affichés à l'utilisateur restent
    inchangés (seule l'agrégation finale est pondérée).
  • humanizer.ts : HumanizeMode devient un alias de ScoreMode
    (plus de duplication de type). Le score avant/après et la boucle
    « jusqu'à naturel » utilisent désormais le mode actif. + 2 règles de
    variation lexicale sûres (intensité aggressive uniquement, jamais de
    faute volontaire).
  • useAIDetector.ts / TextCleaner/index.tsx : le mode actif est
    transmis à chaque analyse (manuelle et en arrière-plan).
  • profileStore.ts (nouveau) : persistance localStorage des
    profils, dégradation silencieuse si le stockage est indisponible.
  • WriterProfilePanel.tsx : profils multiples nommés, sélection,
    suppression, restauration automatique au rechargement.
  • engine.test.ts : +7 tests (pondération par mode, stabilité des
    scores bruts, variation lexicale selon l'intensité, robustesse de
    profileStore sans localStorage).

Vérifications effectuées avant la PR

  • npx tsc --noEmit → 0 erreur
  • npm run lint → 0 erreur (warnings préexistants non liés au diff)
  • npm test → 15/15 (8 existants + 7 nouveaux)
  • npm run build → build de production réussi

Non inclus volontairement

  • Phase 1 (intégration WebLLM) et Phase 2 (embeddings sémantiques) :
    prévues comme spikes séparés, pas encore développées.
  • Les correctifs QA évoqués séparément (page 404, export PDF silencieux,
    etc.) : hors périmètre de cette PR.

Add per-mode scoring weights to the AI-detection engine and turn
the single writer profile into persisted, named, multiple profiles.

Problem:
- analyzeText() scored every text the same way regardless of the
  selected rewrite mode, so academic/professional text was unfairly
  flagged for using formal connectors or lacking oral markers.
- The writer profile lived only in React state: it vanished on
  every reload, and only one profile could exist at a time.

Changes:
- textAnalysis.ts: introduce ScoreMode and MODE_TOLERANCE, weighting
  the contribution of perfection/transition/voice/staccato signals
  to the final score by mode. Raw sub-scores shown to the user stay
  untouched; only the aggregate score and SUCKS sub-metrics shift.
- humanizer.ts: HumanizeMode now aliases ScoreMode (single source
  of truth). performHumanize threads mode through every analyzeText
  call so before/after scores and the "until natural" loop match
  the engine's weighting. Add two opt-in lexical-variation rules
  (aggressive intensity only) that never introduce spelling errors.
- useAIDetector.ts / TextCleaner/index.tsx: thread the active mode
  into manual and background analysis calls.
- profileStore.ts (new) + WriterProfilePanel.tsx: persist profiles
  to localStorage, support multiple named profiles with selection
  and deletion. Storage failures degrade silently.
- engine.test.ts: 7 new tests covering mode weighting, raw-score
  stability, lexical variation gating by intensity, and
  profileStore behavior without localStorage.

Verified: tsc --noEmit, npm run lint, npm test (15/15), npm run
build all pass.
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
project-blueprint Ready Ready Preview, Comment Jun 26, 2026 10:24am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant