Merge the router slots and stage0 sweep (#234)

narrativeQueryBuild hand-rolled a nested token loop that hasTok already does,
identically, in question.go and calendar.go. AnaphoraResolver's doc claimed
Resolve returns a key and value pair; it returns a ref and an ok. The pronoun
list omitted cases the switch already handles.

Filed rather than fixed, V-586: DefaultFactParser matches Russian by
hand-written substring stem and is wired live through voicewire.go. That is the
fourth mechanism CLAUDE.md says was swept out on 2026-08-04, and its output is a
fact. Changing it needs its own measurement.

Classifier baseline unmoved at 27/91 before and after. The ONNX tests skip
without the model and the cascade number needs a live llama-server.

(V-581)
This commit is contained in:
2026-08-06 02:35:25 +04:00
2 changed files with 16 additions and 13 deletions
+8 -4
View File
@@ -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)
+8 -9
View File
@@ -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{