Postagens

import React, { useState, useEffect, useCallback } from 'react'; import { Tone, Aggressiveness, HumanizerState, TransformationStats } from './types'; import { humanizeText } from './services/geminiService'; import { calculateStats, getAggressivenessLabel } from './utils/nlpUtils'; // --- Sub-components (outside main to avoid re-renders) --- const StatCard = ({ label, value, unit = "" }: { label: string, value: string | number, unit?: string }) => ( {label} {value} {unit} ); const App: React.FC = () => { const [state, setState] = useState ({ inputText: '', outputHovered: false, isProcessing: false, result: '', error: null, settings: { tone: Tone.PROFESSIONAL, aggressiveness: Aggressiveness.MEDIUM }, stats: { wordCount: 0, charCount: 0, lexicalDiversity: 0, readabilityScore: 0 } }); useEffect(() => { const st...

Humanizador Pro

import { HumanizerStats } from '../types'; export const calculateStats = (text: string): HumanizerStats => { if (!text.trim()) { return { wordCount: 0, readingEase: 0, lexicalDiversity: 0 }; } // Fix: Explicitly type 'words' as string[] to prevent 'never[]' inference which causes issues in reduce const words: string[] = text.toLowerCase().match(/\b\w+\b/g) || []; const wordCount = words.length; // Lexical Diversity (Type-Token Ratio) const uniqueWords = new Set(words); const lexicalDiversity = wordCount > 0 ? (uniqueWords.size / wordCount) * 100 : 0; // Simple Flesch-Kincaid Reading Ease approximation // (Note: This is a rough estimation suitable for front-end feedback) const sentences = text.split(/[.!?]+/).filter(s => s.trim().length > 0).length || 1; // Fix: Explicitly type accumulator 'acc' as number and 'word' as string to resolve property access and arithmetic errors const syllables = words.re...