Text Highlighting / Citation Tagging

Asked at Harvey · Coding Questions · Difficulty: Medium · Last asked Nov 21, 2026

Given an LLM-generated sentence and a list of source phrases, wrap every matched region in `<yellow></yellow>` tags, merging overlapping or adjacent matches into a single block. Matching is word-level (not substring). The follow-up appends per-tag citation indices ranked by how often each source phrase occurs.

Loading the problem…