diff options
| author | David Schlachter <t480-debian-git@schlachter.ca> | 2026-01-11 14:09:13 -0500 |
|---|---|---|
| committer | David Schlachter <t480-debian-git@schlachter.ca> | 2026-01-11 14:09:13 -0500 |
| commit | 53c51980818258036297986ef3d315c0009ead91 (patch) | |
| tree | fb5484f9958c7ea2a3d74c84804c86d2b59747af | |
| parent | 8f308d86f0157584181afadcd3b3f122690eb32a (diff) | |
Fix genders bug and add number
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | setup.go | 23 |
2 files changed, 21 insertions, 6 deletions
@@ -84,8 +84,8 @@ Usage of french-wiktionary-flashcards: # TODO - Include context hints (e.g. see entry for 'panais', which has "Agriculture", - "Par métonomie", etc) in definitions; and maybe the "singular and plural" box - as well + "Par métonomie", etc) in definitions (tricky because the tags are in english + and I would want to display them in the target language). - allow setting the language for initial processing, so that we could support languages other than French - general code cleanup & organization @@ -141,13 +141,28 @@ func populateDictionary(rawDictionary string, db *sql.DB) error { if len(result.Sounds) > 0 { entry.Sound = result.Sounds[0].IPA } + + var genders, numbers []string for _, r := range result.Tags { - var genders []string - if r == "masculine" || r == "feminine" { - genders = append(genders, r) + switch r { + case "masculine": + genders = append(genders, "masculin") + case "feminine": + genders = append(genders, "féminin") + case "plural": + numbers = append(numbers, "pluriel") + case "singular": + numbers = append(numbers, "singulier") } - entry.Gender = strings.Join(genders, " / ") } + entry.Gender = strings.Join( + []string{ + strings.Join(genders, " / "), + strings.Join(numbers, " et "), + }, + " ", + ) + for _, s := range result.Senses { var example string if len(s.Examples) > 0 { |
