[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/i18n/RFC.md fully. Find ONE feature... #48
2 changed files with 35 additions and 0 deletions
11
validate.go
11
validate.go
|
|
@ -44,6 +44,17 @@ type IrregularResult struct {
|
|||
|
||||
// articlePrompt builds a fill-in-the-blank prompt for article prediction.
|
||||
func articlePrompt(noun string) string {
|
||||
return articlePromptForLang(currentLangForGrammar(), noun)
|
||||
}
|
||||
|
||||
func articlePromptForLang(lang, noun string) string {
|
||||
noun = core.Trim(noun)
|
||||
if isFrenchLanguage(lang) {
|
||||
return core.Sprintf(
|
||||
"Complete with the correct article (le/la/l'/les/un/une/des): ___ %s. Answer with just the article:",
|
||||
noun,
|
||||
)
|
||||
}
|
||||
return core.Sprintf(
|
||||
"Complete with the correct article (a/an/the): ___ %s. Answer with just the article:",
|
||||
noun,
|
||||
|
|
|
|||
|
|
@ -327,6 +327,30 @@ func TestArticlePrompt(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestArticlePromptFrenchLocale(t *testing.T) {
|
||||
prev := Default()
|
||||
svc, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("New() failed: %v", err)
|
||||
}
|
||||
SetDefault(svc)
|
||||
t.Cleanup(func() {
|
||||
SetDefault(prev)
|
||||
})
|
||||
|
||||
if err := SetLanguage("fr"); err != nil {
|
||||
t.Fatalf("SetLanguage(fr) failed: %v", err)
|
||||
}
|
||||
|
||||
prompt := articlePrompt("livre")
|
||||
if !contains(prompt, "livre") {
|
||||
t.Errorf("prompt should contain the noun: %q", prompt)
|
||||
}
|
||||
if !contains(prompt, "le/la/l'/les/un/une/des") {
|
||||
t.Errorf("prompt should mention French article options: %q", prompt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIrregularPrompt(t *testing.T) {
|
||||
prompt := irregularPrompt("swim", "past participle")
|
||||
if !contains(prompt, "'swim'") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue