feed questions ask the seeds, not a stem list (V-522)
Whether a turn is about the feeds is a question about meaning, and internal/router/feeds.go was deciding it with three word lists. Their own comments admit the shape: vagueNouns exists because "что нового?" is the most common opener in the language and it matched a feed noun, so a daemon with no feeds block answered a greeting with a configuration status. So topicFeed joins the four subjects in cmd/mavend/topics.go and queryFeeds calls turnIsAbout. The word lists stay as the offline floor, reached through feedFloor, and they are allowed to stay narrow now that they are not the only answer. The category is not a recogniser — a topic is marked by a preposition — so it comes out of the utterance either way, through the new router.FeedCategoryOf. The greeting is handled by the shape rather than by a bail-out list. "что нового" is a topicOther seed, close enough to the feed seeds that a bare "что нового?" cannot clear topicMargin, and a thin call goes to ParseFeedQuery, which declines a vague noun with no topic beside it. Measured on TestONNXTopics, four held-out cases added: 23/23, and no case that passed before it regressed. One seed pair was added during the measurement, because "какие сегодня заголовки" first read as weather — "какая сегодня погода" was the nearest thing in the whole set carrying "сегодня".
This commit is contained in:
@@ -292,6 +292,14 @@ const (
|
||||
feedReadOut = 3
|
||||
)
|
||||
|
||||
// feedFloor — the keyword test behind topicFeed, in the one-string shape
|
||||
// turnIsAbout takes. router.ParseFeedQuery returns the category too, which the
|
||||
// gate has no use for; the caller reads it separately.
|
||||
func feedFloor(u string) bool {
|
||||
_, ok := router.ParseFeedQuery(u)
|
||||
return ok
|
||||
}
|
||||
|
||||
// queryFeeds — "что нового в лентах?", "что нового по технологиям?"
|
||||
// (Vikunja #258).
|
||||
//
|
||||
@@ -299,10 +307,13 @@ const (
|
||||
// never speaks; asking is the trigger. If that ever changes, the thing that
|
||||
// changed is "Maven is not a nag", not a detail of this file.
|
||||
func (h *reactiveHandler) queryFeeds(ctx context.Context, t *queryTurn) (string, bool) {
|
||||
q, ok := router.ParseFeedQuery(t.dec.Utterance)
|
||||
if !ok {
|
||||
// The seeds decide the subject; router.ParseFeedQuery is the floor behind
|
||||
// them (V-522). The category still comes from the utterance either way,
|
||||
// because a topic is marked by a preposition and needs no recogniser.
|
||||
if !h.turnIsAbout(ctx, t, topicFeed, feedFloor) {
|
||||
return "", false
|
||||
}
|
||||
category := router.FeedCategoryOf(t.dec.Utterance)
|
||||
if !h.feedsOn {
|
||||
// Claim only when nothing below can read the world. The reason this
|
||||
// source used to claim unconditionally was that general knowledge would
|
||||
@@ -327,7 +338,7 @@ func (h *reactiveHandler) queryFeeds(ctx context.Context, t *queryTurn) (string,
|
||||
}
|
||||
var picked []string
|
||||
for _, n := range notes {
|
||||
if !router.CategoryMatches(rss.NoteCategory(n.Text), q.Category) {
|
||||
if !router.CategoryMatches(rss.NoteCategory(n.Text), category) {
|
||||
continue
|
||||
}
|
||||
// The note carries title, summary, category tag and link; she reads the
|
||||
@@ -339,7 +350,7 @@ func (h *reactiveHandler) queryFeeds(ctx context.Context, t *queryTurn) (string,
|
||||
}
|
||||
}
|
||||
if len(picked) == 0 {
|
||||
if q.Category != "" {
|
||||
if category != "" {
|
||||
return phraser.Q(phraser.QueryFeedsTopic, nil), true
|
||||
}
|
||||
return phraser.Q(phraser.QueryFeedsEmpty, nil), true
|
||||
|
||||
Reference in New Issue
Block a user