Harden semantic boundaries and repair dialogue state
Replace nearest-neighbour personal routing with a frozen class-balanced linear head measured on historical, stratified, cross-validation, holdout, and fresh challenge gates (V-702). Close the four repair handoff holes, preserve nested clarification flows, and route Russian possession statements through structural grammar rather than lexical exceptions (V-573). Owner explicitly requested direct commits to master.
This commit is contained in:
@@ -53,20 +53,17 @@ func TestStage0Contention(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// matchingGrammars — every grammar whose pattern matches AND whose Build
|
||||
// accepts, in the daemon's order. Route stops at the first; this does not.
|
||||
// matchingGrammars — every regexp or structural grammar that accepts, in the
|
||||
// daemon's order. Route stops at the first; this does not.
|
||||
func matchingGrammars(grammars []router.Grammar, utterance string) []string {
|
||||
stripped, hadWake := router.StripWakeToken(utterance)
|
||||
var out []string
|
||||
for _, g := range grammars {
|
||||
m := g.Pattern.FindStringSubmatch(utterance)
|
||||
if m == nil && hadWake {
|
||||
m = g.Pattern.FindStringSubmatch(stripped)
|
||||
_, matched, ok := g.Evaluate(utterance)
|
||||
if !matched && hadWake {
|
||||
_, matched, ok = g.Evaluate(stripped)
|
||||
}
|
||||
if m == nil {
|
||||
continue
|
||||
}
|
||||
if _, ok := g.Build(m); !ok {
|
||||
if !matched || !ok {
|
||||
continue
|
||||
}
|
||||
out = append(out, g.Name)
|
||||
|
||||
Reference in New Issue
Block a user