Require route evidence in displayed snippets
This commit is contained in:
@@ -1838,8 +1838,11 @@ func researchFindingMatchesIntent(query string, finding epistemics.ResearchFindi
|
||||
if len(routeTerms) < 2 {
|
||||
return true
|
||||
}
|
||||
// A route-looking URL or page title alone is not enough for a human-facing
|
||||
// answer: the displayed excerpt itself must support both endpoints.
|
||||
excerptEvidence := strings.ToLower(finding.Excerpt.Text)
|
||||
for _, term := range routeTerms {
|
||||
if !strings.Contains(evidence, term) {
|
||||
if !strings.Contains(excerptEvidence, term) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func TestNearestFlightEvidenceRequiresBothRouteEndpointsWhenKnown(t *testing.T)
|
||||
if !researchFindingMatchesIntent(query, matched) {
|
||||
t.Fatal("route evidence with both endpoints was rejected")
|
||||
}
|
||||
unrelated := epistemics.ResearchFinding{Source: epistemics.Source{Title: "Ближайшие города к Казани"}, Excerpt: epistemics.SourceExcerpt{Text: "Авиабилеты и расстояние до Казани."}}
|
||||
unrelated := epistemics.ResearchFinding{Source: epistemics.Source{Title: "Рейсы Москва — Казань", Locator: "https://example.test/moscow-kazan"}, Excerpt: epistemics.SourceExcerpt{Text: "Ближайшие к Казани города и расстояние до них."}}
|
||||
if researchFindingMatchesIntent(query, unrelated) {
|
||||
t.Fatal("one-ended travel evidence was accepted")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user