NumPy allowed · plain Python earns 10 bonus points
Cosine-like similarity scores ranked before context assembly
Implement sentence-boundary-respecting chunking -- a real improvement over blind fixed-size chunking that never splits mid-sentence.
Implement semantic_chunk(sentences, max_chunk_chars). Greedily pack consecutive sentences (joined with a single space) into a chunk as long as adding the next sentence keeps the chunk's total length <= max_chunk_chars. Start a new chunk when the next sentence would exceed the limit. A single sentence longer than max_chunk_chars becomes its own chunk unchanged.
semantic_chunk(sentences: list[str], max_chunk_chars: int) -> list[str]