4c40a183cf
- Add events table (migration #4): stores normalized (action, object, ts) triples extracted from facts, indexed for recurrence detection. - Add proposed_routines table: stores inferred recurring patterns with proposed/accepted/dismissed status and optional linked reminder. - Add pattern package: Extractor normalizes fact text into (action, object) pairs with TTS normalization; Detector groups events to find recurring patterns and proposes routines. - Add internal/ttsnorm: text normalization pipeline for Russian/English (lowercase, punctuation strip, number normalization, stopword removal). - Add chat seed file for LLM phraser.
23 lines
777 B
Go
23 lines
777 B
Go
package ttsnorm
|
|
|
|
import "testing"
|
|
|
|
func TestSpeakable(t *testing.T) {
|
|
cases := []struct{ in, want string }{
|
|
{"напомню 10.07.2026", "напомню 10 июля 2026"},
|
|
{"срок 01.01", "срок 1 января"},
|
|
{"встреча в 14:00", "встреча в 14 часов 00 минут"},
|
|
{"в 9:05 подъём", "в 9 часов 05 минут подъём"},
|
|
{"это 3.2.1 версия", "это 3 точка 2 точка 1 версия"},
|
|
{"без чисел", "без чисел"},
|
|
}
|
|
for _, c := range cases {
|
|
if got := Speakable(c.in); got != c.want {
|
|
t.Errorf("Speakable(%q) = %q, want %q", c.in, got, c.want)
|
|
}
|
|
if got := Speakable(Speakable(c.in)); got != Speakable(c.in) {
|
|
t.Errorf("not idempotent for %q: %q", c.in, got)
|
|
}
|
|
}
|
|
}
|