# `Semantics`: Canonical Semantic Role Map ```{py:currentmodule} irix.semantics ``` Loads `irix/data/semantics.yaml` -- the distilled house mapping of semantic theme roles to canonical `hue-shade` palette addresses -- and classifies foreign theme keys onto those roles. Two classifiers are provided, both deterministic and table-driven: - `Semantics.classify_scope` maps a TextMate-style scope string (`comment.line.double-slash`, `entity.name.function`, ...) to a canonical role key. - `Semantics.classify_workbench` maps a workbench color key (`editor.background`, `statusBar.errorBackground`, `terminal.ansiRed`, ...) to a canonical role key. Role lookups (`Semantics.address`) use prefix fallback: `keyword.control.foo` resolves to `keyword.control` and then `keyword` until a table entry matches. A role's address is either a plain `hue-shade` string (serves both modes) or a per-mode `{dark: ..., light: ...}` override for the rare role whose Radix rung is legible in one mode but not the other -- see [](architecture.md) for the design rationale. ## Type Aliases ```{eval-rst} .. autodata:: irix.semantics.Mode ``` ```{eval-rst} .. autodata:: irix.semantics.RoleAddress ``` ```{eval-rst} .. autoclass:: irix.semantics.Semantics ``` ## `I` Initial Methods ```{eval-rst} .. automethod:: irix.semantics.Semantics.load ``` ## `II` Public Methods ```{eval-rst} .. automethod:: irix.semantics.Semantics.address ``` ```{eval-rst} .. automethod:: irix.semantics.Semantics.classify_scope ``` ```{eval-rst} .. automethod:: irix.semantics.Semantics.classify_workbench ```