Muttersprache koppeln und russischen A1-Kurs ergänzen
GUI und neue Erklärungen verwenden gemeinsam native_language. Deutsch und Russisch sind die beiden Muttersprachen; Englisch bleibt die Lernsprache. Kompatibilitätsfelder werden atomar gekoppelt, widersprüchliche Eingaben abgewiesen und bestehende Profile sowie eingefrorene Inhalte erhalten. Ergänzt vollständige russische GUI-Kataloge und 840 geprüfte Aufgabenansichten in sieben Modulen einschließlich A1-Test, mit getrennten Sprachrollen für Ausgangs- und Lernmaterial. Äquivalente Ansichten teilen ihre Nachweisidentität. Stabile API-Fehlercodes, neue deterministische Hilfen und Trainingsbegründungen berücksichtigen die Muttersprache. Dokumentiert das Sprachmodell in AGENTS.md. Validierung: Go-Race-Suite mit eigener lokaler PostgreSQL-Testdatenbank, go vet, Web-Build, Offline-Bank-/Variantenaudit, Diff-Prüfung sowie lokale Browser-Smokes für Sprachen, Kurs, Administration, Aussprache und Aufnahme. Keine Live-Anbieter, Produktionsprofile, Deployment-Schritte oder historischen Neubewertungen.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package pronunciation
|
||||
|
||||
import (
|
||||
"speech-learning-api/internal/domain"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNativePlanReasonPreservesEvidence(t *testing.T) {
|
||||
for _, mode := range []string{"general", "targeted", "transfer"} {
|
||||
target := &domain.PronunciationTarget{Kind: "phoneme", Symbol: "θ", Samples: 3, Mean: 64, State: "needs_practice"}
|
||||
plan := domain.PronunciationPlan{Mode: mode, Category: "targeted", Target: target, RequiredWords: []string{"three"}, Reason: "historical German reason"}
|
||||
if mode == "general" {
|
||||
plan.Target = nil
|
||||
}
|
||||
SetNativeLanguage(&plan, "ru-RU")
|
||||
if plan.NativeLanguage != "ru-RU" || plan.Reason == "historical German reason" || plan.RequiredWords[0] != "three" || target.Samples != 3 || target.Mean != 64 {
|
||||
t.Fatal(plan)
|
||||
}
|
||||
if mode == "transfer" && !strings.Contains(plan.Reason, "ещё должно быть проверено Azure") {
|
||||
t.Fatal("transfer presented as confirmed", plan.Reason)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,3 +408,34 @@ func label(t domain.PronunciationTarget) string {
|
||||
}
|
||||
return "Wort „" + t.Symbol + "“"
|
||||
}
|
||||
|
||||
// SetNativeLanguage formats only the reason of a newly selected plan. Evidence,
|
||||
// priority, required words and historical plans remain unchanged.
|
||||
func SetNativeLanguage(plan *domain.PronunciationPlan, native string) {
|
||||
plan.NativeLanguage = native
|
||||
if native != "ru-RU" {
|
||||
return
|
||||
}
|
||||
if plan.Target == nil {
|
||||
plan.Reason = "Общая практика произношения: пока нет подтверждённой цели тренировки."
|
||||
return
|
||||
}
|
||||
target := plan.Target
|
||||
label := "Слово «" + target.Symbol + "»"
|
||||
if target.Kind == "phoneme" {
|
||||
label = "Звук /" + target.Symbol + "/"
|
||||
}
|
||||
if target.Kind == "omission" {
|
||||
label = "Полнота произнесения слова «" + target.Symbol + "»"
|
||||
}
|
||||
switch {
|
||||
case plan.Mode == "transfer":
|
||||
plan.Reason = fmt.Sprintf("Потренируйте измеренный звук /%s/ в новом слове; соответствие ещё должно быть проверено Azure.", target.Symbol)
|
||||
case plan.Category == "review":
|
||||
plan.Reason = fmt.Sprintf("Повторение после перерыва: %s. Ранее наблюдалось улучшение.", label)
|
||||
case target.State == "needs_practice":
|
||||
plan.Reason = fmt.Sprintf("%s: повторные затруднения в независимых наблюдениях (%d).", label, target.Samples)
|
||||
default:
|
||||
plan.Reason = fmt.Sprintf("%s: нужна дополнительная проверка, пока наблюдений мало или они неоднородны.", label)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user