diff --git a/internal/router/slots.go b/internal/router/slots.go index cd87081..15e8f02 100644 --- a/internal/router/slots.go +++ b/internal/router/slots.go @@ -438,18 +438,22 @@ func parseDurationValue(s string) (string, bool) { } // AnaphoraResolver resolves pronouns like "это", "он", "она" to the prior -// turn's key entity. Returns a (key, value) pair the prior fact carried, -// or ("", "", false) when no pronoun is detected. +// turn's key entity. Returns the matched pronoun's class as ref, or +// ("", false) when no pronoun is detected — the caller cross-references ref +// against the prior turn's own slots, this type holds no state of its own. type AnaphoraResolver struct{} // Resolve checks if text contains an anaphoric reference to a prior turn's // entity. For MVP this handles the common Russian pronouns: -// - "это" / "этого" / "этому" / "этим" / "этом" → "this" (most common) +// - "это" / "этого" / "этому" / "этим" / "этом" / "эти" / "эта" → "this" +// (most common) // - "он" / "его" / "ему" / "ним" → "he/it", masc // - "она" / "её" / "ей" / "ней" → "she/it", fem // - "оно" → "it", neuter +// - "тот" / "та" / "то" / "те" → "that" +// - "мой" and its declined forms → "mine" // -// Returns the matching pronoun type for cross-referencing with prior slots. +// Returns the matching pronoun class for cross-referencing with prior slots. func (AnaphoraResolver) Resolve(text string) (ref string, ok bool) { s := strings.ToLower(strings.TrimSpace(text)) toks := strings.Fields(s) diff --git a/internal/router/stage0.go b/internal/router/stage0.go index fe0cb0a..8faa4f0 100644 --- a/internal/router/stage0.go +++ b/internal/router/stage0.go @@ -292,16 +292,15 @@ func narrativeQueryBuild(m []string) (Decision, bool) { if chatNarrativeTopics.MatchString(m[0]) { return Decision{}, false } - for _, t := range planTokens(topic) { - for _, v := range captureVerbs { - if t == v { - return Decision{}, false - } + toks := planTokens(topic) + for _, v := range captureVerbs { + if hasTok(toks, v) { + return Decision{}, false } - for _, v := range entertainmentNouns { - if t == v { - return Decision{}, false - } + } + for _, v := range entertainmentNouns { + if hasTok(toks, v) { + return Decision{}, false } } return Decision{