Skip to content

load and flatten stylebank.json (1/3 for #24) - #47

Merged
AnnaWegmann merged 5 commits into
24-stylebankfrom
24-stylebank-loader
Aug 13, 2026
Merged

load and flatten stylebank.json (1/3 for #24)#47
AnnaWegmann merged 5 commits into
24-stylebankfrom
24-stylebank-loader

Conversation

@AnnaWegmann

@AnnaWegmann AnnaWegmann commented Aug 13, 2026

Copy link
Copy Markdown
Owner

First slice of #24 (including stylebank.json).

Adds diversify_text/styles/load.py: reads the packaged stylebank.json via importlib.resources and flattens the nested taxonomy into the flat name → examples dict the rest of the code expects. The JSON is never modified. All shaping happens at load time, including cleaning the two leaf names with awkward characters (barbadian_creole_(bajan)barbadian_creole, education_somehighschool,nodiplomaeducation_some_highschool_no_diploma). Duplicate leaf names and malformed leaves fail loudly.

Nothing is wired up yet: DEFAULT_STYLE_BANK is unchanged. The swap comes in the next PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 11:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AnnaWegmann
AnnaWegmann changed the base branch from main to 24-stylebank August 13, 2026 12:14

@AnnaWegmann AnnaWegmann left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok with updates!

@AnnaWegmann
AnnaWegmann merged commit 6ebff32 into 24-stylebank Aug 13, 2026
4 checks passed
@AnnaWegmann
AnnaWegmann deleted the 24-stylebank-loader branch August 13, 2026 12:57
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