hn.today

A font that reads what you wrote

rohanadwankar.github.io3 points1 comments
Screenshot of A font that reads what you wrote

semfont is a small library that analyzes plain text and maps semantic signals to typography to make prose easier to scan. It computes four per-word scores: valence (good/bad, -1 to 1) adjusted by nearby negators (reach ~3 words, with damping) and intensifiers; salience (0-1) from corpus rarity plus repetition within the passage; surprise (0-1) from explicit cue words, contrast windows (six words after a contrast, decaying with distance), and words much rarer than the passage mean; and certainty (−1 to 1) from hedge and assertion words, with hedges propagating ~55% to the rest of the sentence. Those scores are mapped to visual axes (valence→color, salience→weight, surprise→highlight, certainty→slant) with thresholds so most words remain untouched.

A second, clause-aware pass resolves longer-range phenomena: negators reach to clause end with distance-based fading; verbs like fixed mark following tokens as resolved; sarcasm and comparative patterns get special cases. The engine exposes analyze() for token scores and a styleFor/themes layer to produce CSS, plus a React SemanticText component for streaming chat UIs. It’s lightweight enough to run client-side via an import map/CDN and is intended for live AI streams; imperfections are expected and future work targets sarcasm, embedded-clause negation, and domain vocabularies. Code and demo live at github.com/RohanAdwankar/semfont.

Read on rohanadwankar.github.io1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

Vibecoding isn't a crime How Distribute Your App on Linux after Flathub refusal

Vibecoding isn't a crime How Distribute Your App on Linux after Flathub refusal

Flathub updated its policy to ban applications containing AI-generated or AI-assisted content, including code and documentation, effectively blocking many developers from distributing their apps. The policy is criticized for being unclear, overly broad, and unfairly punishing transparency, especially for open-source projects using AI tools during development. (grigio.org)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.