Tighten evidence context source excerpts

This commit is contained in:
2026-08-09 20:04:46 +00:00
parent f6d037b613
commit bef8ca263b
6 changed files with 15 additions and 491 deletions

View File

@@ -44,7 +44,11 @@ func Build(request BuildRequest) (Document, error) {
}
merged := mergeRanges(ranges)
document := make(Document, 0)
unitCount := 0
for _, value := range merged {
unitCount += value.endPos - value.startPos + 1
}
document := make(Document, 0, unitCount)
for _, value := range merged {
for position := value.startPos; position <= value.endPos; position++ {
unit, err := cloneSourceUnit(request.Source.Units[position])