3d8224fb04
"сеть какая-то медленная" and "интернет не работает" were written as `self` rows at confidence 1.00. Recall reads a self row back later as if it were still true, and that is the class of row that outranked live search in #470 — so a slow afternoon becomes a standing belief about his network. IsTransientComplaint is the same shape as IsQuestionShaped: deterministic, offline, and off by default in the two cases where losing a real capture would cost more than keeping a complaint. An explicit "запомни ..." wins, because he asked. A first-person marker wins, because "я сломал руку" is durable and the test is meant for sentences about things. She answers the turn as chat instead of storing it. actionChat now has the same nil-phraser floor the other model callers have. The second defect filed here — a reply body of literally "{" — was closed by the errBrokenJSON path in V-397 and needs nothing further.
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package router
|
|
|
|
import "testing"
|
|
|
|
func TestIsTransientComplaint(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
text string
|
|
want bool
|
|
}{
|
|
// The two rows from the QA run that named this bug.
|
|
{"сеть какая-то медленная", true},
|
|
{"интернет не работает", true},
|
|
{"вайфай тормозит", true},
|
|
{"сервер завис", true},
|
|
{"the wifi is slow", true},
|
|
|
|
// An instruction wins: he asked for it to be written down.
|
|
{"запомни что интернет не работает", false},
|
|
{"запиши что сеть медленная", false},
|
|
|
|
// About him, so it stays a fact even when it sounds like a complaint.
|
|
{"я сломал руку", false},
|
|
{"мне медленно думается", false},
|
|
|
|
// Ordinary captures must not be touched.
|
|
{"поужинал", false},
|
|
{"выпил воды", false},
|
|
{"машина на парковке", false},
|
|
{"", false},
|
|
} {
|
|
if got := IsTransientComplaint(tc.text); got != tc.want {
|
|
t.Errorf("IsTransientComplaint(%q) = %v, want %v", tc.text, got, tc.want)
|
|
}
|
|
}
|
|
}
|