Skip to content

feat(dataset-updater): Virtues FR→EN/RU/PT translation configs (#218 phase 2) - #231

Merged
jsboige merged 1 commit into
masterfrom
feat/virtues-translation-configs
Apr 24, 2026
Merged

feat(dataset-updater): Virtues FR→EN/RU/PT translation configs (#218 phase 2)#231
jsboige merged 1 commit into
masterfrom
feat/virtues-translation-configs

Conversation

@jsboige

@jsboige jsboige commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Completes phase 2 of #218. With the CSV i18n columns (PR #223) and Virtue entity scaffold (PR #229) now on master, this PR wires the DatasetUpdater to populate Virtues translations via OpenAI.

What's added

3 new configs in `DatasetUpdaterRootConfig.cs` (Enabled=false each)

Name Target fields Model
Translate Virtues to English by chunk empty-only 0-shot `family_en`, `subfamily_en`, `subsubfamily_en`, `title_en`, `description_en`, `remark_en`, `link_en` gpt-5.4-mini
Translate Virtues to Russian by chunk empty-only 0-shot `*_ru` gpt-5.4-mini
Translate Virtues to Portuguese by chunk empty-only 0-shot `*_pt` (pt-PT) gpt-5.4-mini

6 new prompt files in `DatasetUpdater/Resources/`

`PromptVirtuesTranslate{En,Ru,Pt}{User,Assistant}.txt` — each enforces:

  • Taxonomy coherence across entries (same family name translated consistently)
  • FR "vous" register → target-language equivalent (infinitive EN, impératif/infinitif RU, 2nd person formal pt-PT)
  • Canonical logic terminology
  • Wikipedia link localization when an equivalent page exists

Design rationale

  • `SelectEmptyTargets=true` — re-runs only fill gaps, so iterative passes are cheap
  • `ChunkSize=8`, `MaxGroupItemNb=12` — small batches because translation quality degrades on niche logic terms with large batches
  • Eco tier (`gpt-5.4-mini`) matching Fallacies translation configs that are already production-proven
  • pt-PT explicit (not pt-BR), consistent with Rules PT retranslation (Full retranslation needed for PT Rules CSV (blocked by #183) #211)

Test plan

Follow-ups not in this PR

🤖 Generated with Claude Code

)

Completes phase 2 of #218 by wiring the DatasetUpdater to the Virtues
taxonomy now that the CSV columns (_en/_ru/_pt) and entity properties
are in place (PR #223 + #229 — both merged on master).

Changes:
- DatasetUpdaterRootConfig.cs: 3 new configs (Enabled=false each),
  one per target language. Same structure as the Fallacies translation
  configs that have been production-proven on this pipeline
- 6 new prompt files adapted for Virtues taxonomic content:
  - PromptVirtuesTranslate{En,Ru,Pt}{User,Assistant}.txt
  - Each enforces taxonomy coherence across entries, FR "vous" →
    target-language register, canonical logic terminology, and
    wiki link localization

Design notes:
- SelectEmptyTargets=true so re-runs only fill gaps (cheap deltas)
- ChunkSize=8, MaxGroupItemNb=12 — small batches for translation
  quality (large batches tend to drift on niche logic terms)
- Model: gpt-5.4-mini (eco tier, matches Fallacies translation configs)
- pt-PT explicitly requested (not pt-BR), consistent with Rules PT
  retranslation (#211)

Test plan:
- dotnet build succeeds
- 88 tests pass
- End-to-end: set Enabled=true on one config, run pipeline with
  OpenAI key, verify 3-5 rows translate cleanly (same validation gate
  as #183 DatasetUpdater acceptance)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsboige
jsboige merged commit 108840a into master Apr 24, 2026
1 check passed
jsboige added a commit that referenced this pull request Apr 24, 2026
Adds 3 DatasetUpdaterConfig entries (Enabled=false) for translating the 76
untranslated scenarios per target language (EN/RU/PT) via OpenAI GPT-5.4-mini,
plus 6 Scenarii-specific prompt files (User + Assistant x 3 languages).

Audit (167 total FR-complete scenarios):
- EN: 85 scenarios missing ≥1 field (category, subcategory, title,
  smoothTalker, drawer, context, issue, suggestion_en)
- RU: 76 scenarios missing _ru fields
- PT: 76 scenarios missing _pt fields

Config pattern mirrors #231 (Virtues): SequentialChunks, ChunkSize=8,
SelectEmptyTargets=true, MaxGroupItemNb=12, UseFunctionCalling=true.
Each config uses a dedicated prompt pair tailored to scenario context:
- Scenarii-specific field mapping (catégorie→category, baratineur→smoothTalker,
  piocheur→drawer, enjeu→issue, suggestion→suggestion_en — only one with suffix)
- Narrative-tone instructions (rhythm, humor, brevity)
- pt-PT (not pt-BR); Russian contemporary register (not archaic)
- Category/subcategory consistency across scenarios
- Measured adaptation of French cultural references

Prerequisites satisfied: SDK migration #183 (PR #210) + GPT-5.x models (PR #222).
Scenario.cs entity already had complete i18n scaffolding (EN without _en suffix
is historical design; RU/PT use suffix).

Build: 0 errors, 17 warnings (pre-existing).
Tests: 88 pass, 1 skip (Freeplane GUI), 0 fail.

Closes #219 (pending successful end-to-end run with OpenAI key).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Apr 25, 2026
…anslations + fix BOM bug + csproj wildcards (#236)

Closes #236.

## Summary

### Prompt refinement (#236)
- Fix hallucinated "Vous → impératif" instruction (FR descriptions are declarative/nominal, not 2nd person)
- Add canonical family mapping (9 EN / 12 PT / 12 RU families with fixed translations)
- Wikipedia link caveat (no fabricated URLs, leave empty if uncertain)
- Align assistant prompts with corrected user prompts

### csproj copy gap fix (#236)
- Replace 21 explicit `<None Update>` entries with 2 wildcards (`*.txt`, `*.json`)
- Fixes latent bug from #228/#231/#232: 21 resource files (Virtues/Scenarii/Rules prompts, CSV samples, Fallacies JSON) were not copied to bin output, blocking DatasetUpdater runs

### Virtues taxonomy translation campaign
- EN: 218/223 (97.8%), 1468 _en fields
- PT: 223/223 (100%), 1503 _pt fields (links cleared due to hallucination risk — see follow-up note)
- RU: 220/223 (98.7%), 1480 _ru fields
- All 8 family translations consistent across each language

### TokenManager fix
- SharpToken throws on unknown models (e.g. gpt-5.4-mini) — added try/catch with cl100k_base fallback

### Critical bug fix: BOM accumulation in DatasetUpdater
- `UtilityExtensions.cs`: strip BOM on read with `TrimStart('')`
- `DataSetInfo.cs`: write without BOM via `new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)`
- CSV: stripped 3 accumulated BOMs from header (1 per translation cycle EN/PT/RU)
- Without fix: CsvHelper would silently mismatch `pk` column header → empty PK column → broken `SelectEmptyTargets` idempotency for all future DatasetUpdater runs

### Review feedback follow-ups
1. EN subsubfamily inconsistency — pk=4,5 "Actual argument" → "Real argument" (matching pk=3, canonical mapping)
2. PT links cleared (203 URLs) — conservative cleanup vs hallucination risk, can be regenerated via future PT run with corrected prompt + caveat

## Validation
- ✅ Build: 0 errors, 17 warnings (identical to master)
- ✅ Tests: 88 pass / 0 fail / 1 skip (identical to master)
- ✅ CSV: 0 BOM, header `pk` clean
- ✅ EN consistency: 3× "Real argument", 0× "Actual argument"

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@clusterManager-Myia

Copy link
Copy Markdown
Collaborator

Post-hoc review — PR #231 feat(dataset-updater): Virtues FR→EN/RU/PT translation configs (#218 phase 2)

Verdict: ⚠️ Mostly LGTM — prompt issues noted (fixed in #238)

This PR wires the DatasetUpdater to populate Virtues translations via OpenAI function calling. Three new configs (EN, RU, PT) + 6 prompt template files.

Positive:

  • Configs are Enabled = false — safe default.
  • SelectEmptyTargets = true — only fills blank fields, won't overwrite existing translations.
  • AutoCompare = true with title_fr/title_en comparison — smart quality gate.
  • ChunkSize = 8 for Virtues (smaller dataset than Fallacies) is appropriate.

Prompt concerns (noted as fixed in #238):

  • EN prompt incorrectly states descriptions use "vous" (2nd person) — PR description says they're actually declarative/nominal. This would cause the LLM to produce wrong register.
  • RU prompt also references imperative/infinitive style which is incorrect.
  • No canonical family mapping provided — LLM might produce inconsistent taxonomy names.
  • Wikipedia link instruction is too aggressive ("cherche l'équivalent") — risks hallucinated URLs.

Since #238 fixes these prompt issues, the overall trajectory is correct, but this PR in isolation has prompt quality problems that could produce bad translations if run as-is.

Verdict adjusted: Acceptable as a scaffold, but should not be run without #238's prompt fixes applied.

@jsboige
jsboige deleted the feat/virtues-translation-configs branch June 1, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants