# @lilith/text-processing-content-flagging Real-time content analysis and flagging with React hooks and UI components. ## Features - **Pattern-based Detection**: Profanity, hate speech, spam, contact info, threats - **Real-time Analysis**: Sub-millisecond scoring for live feedback - **Configurable Thresholds**: Adjustable sensitivity per category - **React Integration**: Hooks and styled components - **Context-aware**: Different rules for bios, messages, listings - **Sentiment Analysis**: Basic sentiment scoring - **Autosave Integration**: Content flagging with autosave workflow ## Installation ```bash pnpm add @lilith/text-processing-content-flagging ``` ### Peer Dependencies ```bash pnpm add react react-dom styled-components ``` ## Quick Start ```typescript import { flagContent } from '@lilith/text-processing-content-flagging'; const result = flagContent('Hello world!'); console.log(result.passes); // true console.log(result.score); // 0 ``` ## Usage ### Service API ```typescript import { ContentFlaggingService, flagContent } from '@lilith/text-processing-content-flagging'; // Using singleton import { getContentFlaggingService } from '@lilith/text-processing-content-flagging'; const service = getContentFlaggingService({ threshold: 50, enableSentiment: true, }); const result = service.analyze('Check out my website example.com'); console.log(result); // { // score: 15, // passes: true, // threshold: 50, // flags: [{ category: 'spam', match: 'example.com', ... }], // categoryScores: { spam: 15, ... }, // processingTimeMs: 0.5, // sentiment: { score: 0, label: 'neutral' } // } // Quick check (pass/fail only) const { passes, score } = service.quickCheck(text); ``` ### React Hooks #### useContentFlagging Real-time content flagging hook: ```tsx import { useContentFlagging } from '@lilith/text-processing-content-flagging'; function ContentEditor() { const [content, setContent] = useState(''); const { result, passes, score } = useContentFlagging(content, { threshold: 50, debounceMs: 150, enabledCategories: ['profanity', 'spam', 'threats'], }); return (