Skip to content

feat(dataset-updater): add Rules PT translation config - #228

Merged
jsboige merged 1 commit into
masterfrom
feat/dataset-updater-rules-config
Apr 24, 2026
Merged

feat(dataset-updater): add Rules PT translation config#228
jsboige merged 1 commit into
masterfrom
feat/dataset-updater-rules-config

Conversation

@jsboige

@jsboige jsboige commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds DatasetUpdater support for translating Argumentum Rules (FR→PT), replacing the need for the standalone Python script used in PR #225.

Changes

  • Rule.cs: Add Pk property + ClassMap mapping (primary key for DatasetUpdater)
  • Rules CSV: Add pk column (Rules_01 through Rules_18)
  • DatasetUpdaterRootConfig.cs: Add TranslateRulesToPt config (Enabled=false)
  • Prompt files: PromptRulesTranslatePtUser.txt + PromptRulesTranslatePtAssistant.txt

Config details

Setting Value
Model gpt-5.4-mini (fallback: gpt-4.1-mini)
DivisionMode SequentialChunks, ChunkSize=3
FunctionCalling enabled
SelectEmptyTargets false (overwrite all)
PrimaryField pk

Relationship to PR #225

PR #225 provides the immediate fix (Python script translation of 18 PT Rules). This PR provides the infrastructure so future Rules translations (EN, RU, or PT refresh) can use the DatasetUpdater directly.

Test plan

  • Build: 0 errors, 17 warnings (baseline)
  • Tests: 88 pass / 0 fail / 1 skip (Freeplane GUI)
  • ai-01 review: config + prompts quality
  • Future: enable and run to validate end-to-end

🤖 Generated with Claude Code

@jsboige
jsboige force-pushed the feat/dataset-updater-rules-config branch from de9b336 to a99f228 Compare April 24, 2026 00:24
Adds DatasetUpdater support for translating Argumentum Rules from FR to PT,
replacing the need for standalone Python scripts.

Changes:
- Rule.cs: add Pk property + ClassMap mapping (primary key for DatasetUpdater)
- Rules CSV: add pk column (Rules_01 through Rules_18)
- DatasetUpdaterRootConfig.cs: add TranslateRulesToPt config (Enabled=false)
- Prompt files for Rules FR→PT translation (markdown-aware, game terms preserved)

Config details:
- Model: gpt-5.4-mini (fallback: gpt-4.1-mini)
- DivisionMode: SequentialChunks, ChunkSize=3
- FunctionCalling enabled, SelectEmptyTargets=false (overwrite all)
- MaxDegreeOfParallelism=3

Complements PR #225 (Python-based PT Rules retranslation for immediate fix).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jsboige
jsboige force-pushed the feat/dataset-updater-rules-config branch from a99f228 to b5b5031 Compare April 24, 2026 00:49
@jsboige
jsboige merged commit f9e1c5d into master Apr 24, 2026
1 check passed
jsboige added a commit that referenced this pull request Apr 24, 2026
…-column

fix(rules): restore pk column to Rules CSV (follow-up to #228)
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 #228 feat(dataset-updater): add Rules PT translation config

Verdict: ✅ LGTM — with one concern about CSV edits

This PR adds DatasetUpdater infrastructure for Rules FR→PT translation, replacing the standalone script from PR #225. The config follows the established pattern with DivisionMode.SequentialChunks, ChunkSize = 3, function calling enabled.

Positive:

  • Rule.cs gets a Pk property — necessary for PrimaryField = "pk" in the config.
  • Prompt templates are well-crafted: pt-PT specific instructions, game terminology preservation, markdown format requirements.
  • New DatasetUpdater configs are Enabled = false by default — safe.

Concern:

  • The CSV diff shows both content changes (line ending normalization ) AND what appears to be a pk column addition. However, PR fix(rules): restore pk column to Rules CSV (follow-up to #228) #233 was needed as a follow-up to actually restore the pk column. This suggests the CSV change in this PR may have been incomplete or reverted. Worth verifying the CSV state on master.

Prompt quality (PT):

  • Specifies European Portuguese explicitly ✓
  • Preserves markdown formatting ✓
  • Game terminology mapping is explicit ✓

Good infrastructure addition.

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