f4de2fc5e1
The third-person check asks whether anyone else was named before "он". A nudge is mostly verbs, and they were counted as possible people, so "попробуй встать и отдохнуть — у него есть перерыв" passed. Infinitives and imperatives now join past tense as words that cannot be a person. A plain noun before the pronoun still blinds it. That needs a parser, and the comment says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGeSZxh1DCtRxmFVSYVGvJ
43 lines
1.7 KiB
Go
43 lines
1.7 KiB
Go
package eval
|
|
|
|
import "testing"
|
|
|
|
func TestAddressTimeWordDoesNotBlind(t *testing.T) {
|
|
// A nudge that opens with a time word must still be caught. Without the
|
|
// time words in the stoplist, "сегодня" was read as the third party.
|
|
for _, s := range []string{
|
|
"сегодня он не ел 11 дней",
|
|
"вчера он не пил воду",
|
|
"опять он забыл про таблетки",
|
|
} {
|
|
if r := checkAddress(s); r.Pass {
|
|
t.Errorf("checkAddress(%q) passed, want a third-person failure", s)
|
|
}
|
|
}
|
|
// Still must not fire when a third party really is named.
|
|
for _, s := range []string{
|
|
"сегодня сервис упал, он не отвечает",
|
|
"ты не пил воду четыре часа",
|
|
} {
|
|
if r := checkAddress(s); !r.Pass {
|
|
t.Errorf("checkAddress(%q) failed: %s", s, r.Detail)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestAddressVerbIsNotAnAntecedent — a nudge is mostly verbs, and a verb is
|
|
// never who "он" refers to. This exact string passed the check before.
|
|
func TestAddressVerbIsNotAnAntecedent(t *testing.T) {
|
|
s := "попробуй встать и отдохнуть — у него есть перерыв"
|
|
if r := checkAddress(s); r.Pass {
|
|
t.Errorf("checkAddress(%q) passed, want a third-person failure", s)
|
|
}
|
|
// Still missed, and this is the documented hole: "выпей воды, он не пил" has
|
|
// a real noun ("воды") before the pronoun, so the scan believes somebody
|
|
// else was named. Telling that apart needs a parser, not a suffix rule.
|
|
// A named third party still wins over the verbs around it.
|
|
if r := checkAddress("сервис упал, он не отвечает"); !r.Pass {
|
|
t.Errorf("checkAddress on a real third party failed: %s", r.Detail)
|
|
}
|
|
}
|