A font that reads what you wrote
2 days ago
- Semfont is a library that automatically styles text (color, bold, italic, highlight) based on four word scores: valence (good/bad), salience (importance), surprise (unexpectedness), and certainty (confidence).
- Scores are initially dictionary lookups, then adjusted by rules considering nearby words (e.g., negators flip valence, intensifiers scale it).
- A second pass analyzes entire clauses to handle long-range negation, resolution verbs (e.g., 'fixed' marks following words as positive), and sarcasm detection.
- The library provides React components (<SemanticText>) and a standalone analyzer ('analyze' function) for styling without React, with customizable themes and vocabulary.
- It is designed for streaming AI text to make large outputs easier to read, using heuristic rules that prioritize speed over perfect accuracy.
- Future improvements include handling embedded clauses, sarcasm, and adding technical vocabulary for coding agents.