# Jobs and Occupations

> **Relevant source files**
> * [ArWikiCats/jsons/jobs/activists_keys.json](../ArWikiCats/jsons/jobs/activists_keys.json)
> * [ArWikiCats/new/handle_suffixes.py](../ArWikiCats/new/handle_suffixes.py)
> * [ArWikiCats/new_resolvers/jobs_resolvers/mens.py](../ArWikiCats/new_resolvers/jobs_resolvers/mens.py)
> * [ArWikiCats/new_resolvers/jobs_resolvers/utils.py](../ArWikiCats/new_resolvers/jobs_resolvers/utils.py)
> * [ArWikiCats/new_resolvers/jobs_resolvers/womens.py](../ArWikiCats/new_resolvers/jobs_resolvers/womens.py)
> * [ArWikiCats/new_resolvers/nationalities_resolvers/ministers_resolver.py](../ArWikiCats/new_resolvers/nationalities_resolvers/ministers_resolver.py)
> * [ArWikiCats/translations/__init__.py](../ArWikiCats/translations/__init__.py)
> * [ArWikiCats/translations/build_data/__init__.py](../ArWikiCats/translations/build_data/__init__.py)
> * [ArWikiCats/translations/funcs.py](../ArWikiCats/translations/funcs.py)
> * [ArWikiCats/translations/geo/__init__.py](../ArWikiCats/translations/geo/__init__.py)
> * [ArWikiCats/translations/geo/labels_country.py](../ArWikiCats/translations/geo/labels_country.py)
> * [ArWikiCats/translations/jobs/Jobs.py](../ArWikiCats/translations/jobs/Jobs.py)
> * [ArWikiCats/translations/jobs/Jobs2.py](../ArWikiCats/translations/jobs/Jobs2.py)
> * [ArWikiCats/translations/jobs/jobs_data_basic.py](../ArWikiCats/translations/jobs/jobs_data_basic.py)
> * [ArWikiCats/translations/jobs/jobs_players_list.py](../ArWikiCats/translations/jobs/jobs_players_list.py)
> * [ArWikiCats/translations/jobs/jobs_singers.py](../ArWikiCats/translations/jobs/jobs_singers.py)
> * [ArWikiCats/translations/jobs/jobs_womens.py](../ArWikiCats/translations/jobs/jobs_womens.py)
> * [ArWikiCats/translations/mixed/all_keys2.py](../ArWikiCats/translations/mixed/all_keys2.py)
> * [ArWikiCats/translations/mixed/female_keys.py](../ArWikiCats/translations/mixed/female_keys.py)
> * [ArWikiCats/translations/mixed/keys2.py](../ArWikiCats/translations/mixed/keys2.py)
> * [ArWikiCats/translations/others/__init__.py](../ArWikiCats/translations/others/__init__.py)
> * [ArWikiCats/translations/others/tax_table.py](../ArWikiCats/translations/others/tax_table.py)
> * [ArWikiCats/translations/sports/Sport_key.py](../ArWikiCats/translations/sports/Sport_key.py)
> * [ArWikiCats/translations/tv/films_mslslat.py](../ArWikiCats/translations/tv/films_mslslat.py)
> * [_work_files/data_len.json](../_work_files/data_len.json)

This page documents the jobs and occupations translation system, which provides comprehensive English-to-Arabic mappings for occupational categories with gender-aware handling. The system maintains 97,797 male job entries and 75,244 female job entries, supporting the translation of Wikipedia categories like "British film directors" to "مخرجو أفلام بريطانيون".

For resolver implementation details using these datasets, see [Job Resolvers](18.Job-Resolvers.md). For nationality handling in job categories, see [Nationality Resolvers](16.Nationality-Resolvers.md)

## Overview

The jobs system aggregates occupational translations from multiple JSON sources and builds gendered Arabic labels. It handles special cases including religious occupations, sports-related roles, artistic professions, and scientific disciplines with distinct masculine and feminine forms.

```mermaid
flowchart TD

jobs_json["jobs.json<br/>Primary jobs data"]
Jobs_22["Jobs_22.json<br/>jobs_primary"]
jobs_3["jobs_3.json<br/>jobs_additional"]
jobs_pp["jobs_Men_Womens_PP.json<br/>Gendered job pairs"]
activists["activists_keys.json"]
Religious["RELIGIOUS_KEYS_PP<br/>33 religious roles"]
Sports["SPORT_JOB_VARIANTS<br/>571 sport variants"]
Singers["MEN_WOMENS_SINGERS<br/>432 singer roles"]
Players["PLAYERS_TO_MEN_WOMENS_JOBS<br/>1,342 player roles"]
BuildJobs["_finalise_jobs_dataset()<br/>ArWikiCats/translations/data_builders/build_jobs.py"]
BuildWomens["jobs_womens.py<br/>short_womens_jobs"]
BuildJobsNew["_build_jobs_new()<br/>Combines womens + Nat_mens"]
jobs_mens_data["jobs_mens_data<br/>97,797 entries<br/>3.7 MiB"]
jobs_womens_data["jobs_womens_data<br/>75,244 entries<br/>1.8 MiB"]
Jobs_new["Jobs_new<br/>99,104 entries<br/>Additional womens variants"]

jobs_json --> BuildJobs
Jobs_22 --> BuildJobs
jobs_3 --> BuildJobs
jobs_pp --> BuildJobs
activists --> BuildJobs
Religious --> BuildJobs
Sports --> BuildJobs
Singers --> BuildJobs
Players --> BuildJobs
BuildJobs --> jobs_mens_data
BuildJobs --> jobs_womens_data
BuildJobsNew --> Jobs_new

subgraph subGraph3 ["Final Datasets"]
    jobs_mens_data
    jobs_womens_data
    Jobs_new
end

subgraph subGraph2 ["Data Builders"]
    BuildJobs
    BuildWomens
    BuildJobsNew
    BuildWomens --> BuildJobsNew
end

subgraph subGraph1 ["Specialized Job Data"]
    Religious
    Sports
    Singers
    Players
end

subgraph subGraph0 ["Raw Job Sources"]
    jobs_json
    Jobs_22
    jobs_3
    jobs_pp
    activists
end
```

**Sources:** [ArWikiCats/translations/jobs/Jobs.py L1-L211](../ArWikiCats/translations/jobs/Jobs.py#L1-L211), [_work_files/data_len.json L9-L14](../_work_files/data_len.json#L9-L14)

## Data Aggregation Architecture

The jobs system follows a multi-stage aggregation pipeline that merges domain-specific job datasets with gender-aware transformations.

### Aggregation Pipeline

```mermaid
flowchart TD

LoadPrimary["Load jobs_primary<br/>Jobs_22.json"]
LoadAdditional["Load jobs_additional<br/>jobs_3.json"]
LoadPP["Load jobs_pp<br/>jobs_Men_Womens_PP.json"]
SportVariants["sport_variants<br/>35 entries<br/>From SPORT_JOB_VARIANTS"]
PeopleVariants["people_variants<br/>94 entries<br/>From JOBS_PEOPLE_ROLES"]
MergeReligious["Merge RELIGIOUS_KEYS_PP<br/>33 religious roles"]
MergeSingers["Merge MEN_WOMENS_SINGERS<br/>432 singer entries"]
MergePlayers["Merge PLAYERS_TO_MEN_WOMENS_JOBS<br/>1,342 player entries"]
MergeSports["Merge SPORT_JOB_VARIANTS<br/>571 sport job variants"]
AddExecutive["Add EXECUTIVE_DOMAINS<br/>7 executive types"]
AddDisability["Add DISABILITY_LABELS<br/>3 disability types"]
AddCompanies["Add companies_to_jobs<br/>28 company founder roles"]
AddActivists["Add activists<br/>Activism roles"]
Finalise["_finalise_jobs_dataset()<br/>Combines all sources"]
SplitGender["Split into males/females<br/>_DATASET.males_jobs<br/>_DATASET.females_jobs"]

LoadPrimary --> Finalise
LoadAdditional --> Finalise
LoadPP --> Finalise
SportVariants --> Finalise
PeopleVariants --> Finalise
MergeReligious --> Finalise
MergeSingers --> Finalise
MergePlayers --> Finalise
MergeSports --> Finalise
AddExecutive --> Finalise
AddDisability --> Finalise
AddCompanies --> Finalise
AddActivists --> Finalise

subgraph subGraph4 ["Stage 5: Final Assembly"]
    Finalise
    SplitGender
    Finalise --> SplitGender
end

subgraph subGraph3 ["Stage 4: Apply Transformations"]
    AddExecutive
    AddDisability
    AddCompanies
    AddActivists
end

subgraph subGraph2 ["Stage 3: Merge Specialized Data"]
    MergeReligious
    MergeSingers
    MergePlayers
    MergeSports
end

subgraph subGraph1 ["Stage 2: Generate Variants"]
    SportVariants
    PeopleVariants
end

subgraph subGraph0 ["Stage 1: Load Base Data"]
    LoadPrimary
    LoadAdditional
    LoadPP
end
```

**Sources:** [ArWikiCats/translations/jobs/Jobs.py L150-L183](../ArWikiCats/translations/jobs/Jobs.py#L150-L183), [ArWikiCats/translations/data_builders/build_jobs.py](../ArWikiCats/translations/data_builders/build_jobs.py)

### Key Aggregation Function

The `_finalise_jobs_dataset()` function performs the core aggregation:

```markdown
# From ArWikiCats/translations/data_builders/build_jobs.py
_DATASET = _finalise_jobs_dataset(
    jobs_pp,                        # Base gendered jobs
    sport_variants,                 # Sport-specific variants
    people_variants,                # People role variants
    MEN_WOMENS_JOBS_2,             # Additional gendered jobs
    NAT_BEFORE_OCC,                # Nationality-before-occupation patterns
    MEN_WOMENS_SINGERS_BASED,      # Singer base roles
    MEN_WOMENS_SINGERS,            # Singer variants
    PLAYERS_TO_MEN_WOMENS_JOBS,    # Player roles
    SPORT_JOB_VARIANTS,            # Sport job variants
    RELIGIOUS_FEMALE_KEYS,         # Female religious roles
    BASE_CYCLING_EVENTS,           # Cycling event roles
    JOBS_2,                        # Additional jobs set 2
    JOBS_3333,                     # Additional jobs set 3333
    RELIGIOUS_KEYS_PP,             # Religious keys
    FOOTBALL_KEYS_PLAYERS,         # Football player roles
    EXECUTIVE_DOMAINS,             # Executive domains
    DISABILITY_LABELS,             # Disability labels
    JOBS_2020_BASE,                # 2020 job additions
    companies_to_jobs,             # Company founder roles
    activists,                     # Activist roles
)
```

**Sources:** [ArWikiCats/translations/jobs/Jobs.py L158-L179](../ArWikiCats/translations/jobs/Jobs.py#L158-L179)

## Gender-Specific Data Structures

The jobs system maintains separate male and female datasets with specialized handling for grammatical gender agreement in Arabic.

### Male Jobs Dataset

| Dataset | Size | Example Entry | Usage |
| --- | --- | --- | --- |
| `jobs_mens_data` | 97,797 entries | `"zoologists": "علماء حيوانات"` | Primary male job lookup |
| `Jobs_new` | 99,104 entries | Includes nationality variants | Extended male jobs with nationality combinations |

### Female Jobs Dataset

| Dataset | Size | Example Entry | Usage |
| --- | --- | --- | --- |
| `jobs_womens_data` | 75,244 entries | `"actresses": "ممثلات"` | Primary female job lookup |
| `short_womens_jobs` | 484 entries | `"nuns": "راهبات"` | Core female-specific jobs |
| `FEMALE_JOBS_BASE_EXTENDED` | 51 entries | Religious + base female jobs | Extended female roles |

**Gender-Specific Data Structure:**

```mermaid
flowchart TD

jobs_womens_data["jobs_womens_data<br/>Dict[str, str]<br/>Key → Arabic female label"]
short_womens["short_womens_jobs<br/>Dict[str, str]<br/>Core female jobs"]
jobs_mens_data["jobs_mens_data<br/>Dict[str, str]<br/>Key → Arabic male label"]
Jobs_new["Jobs_new<br/>Dict[str, str]<br/>Extended male labels"]
TypeDef["TypedDict GenderedLabel<br/>{<br/>'males': str,<br/>'females': str<br/>}"]
GenderedLabelMap["GenderedLabelMap<br/>Dict[str, GenderedLabel]<br/>Key → {males, females}"]
RELIGIOUS_KEYS_PP["RELIGIOUS_KEYS_PP<br/>33 religious roles"]
PLAYERS_TO_MEN_WOMENS["PLAYERS_TO_MEN_WOMENS_JOBS<br/>1,342 player roles"]
MEN_WOMENS_SINGERS["MEN_WOMENS_SINGERS<br/>432 singer roles"]

TypeDef --> GenderedLabelMap

subgraph subGraph3 ["Dual-Gender Access"]
    GenderedLabelMap
    RELIGIOUS_KEYS_PP
    PLAYERS_TO_MEN_WOMENS
    MEN_WOMENS_SINGERS
    GenderedLabelMap --> RELIGIOUS_KEYS_PP
    GenderedLabelMap --> PLAYERS_TO_MEN_WOMENS
    GenderedLabelMap --> MEN_WOMENS_SINGERS
end

subgraph subGraph0 ["GenderedLabel Structure"]
    TypeDef
end

subgraph subGraph2 ["Female-Only Access"]
    jobs_womens_data
    short_womens
end

subgraph subGraph1 ["Male-Only Access"]
    jobs_mens_data
    Jobs_new
end
```

**Sources:** [ArWikiCats/translations/jobs/Jobs.py L181-L183](../ArWikiCats/translations/jobs/Jobs.py#L181-L183), [ArWikiCats/translations/data_builders/jobs_defs.py](../ArWikiCats/translations/data_builders/jobs_defs.py), [_work_files/data_len.json L9-L15](../_work_files/data_len.json#L9-L15)

## Job Categories

### Religious Occupations

Religious jobs require special handling due to their intersection with nationality and gender. The system maintains 33 base religious role types.

```mermaid
flowchart TD

RELIGIOUS_KEYS_PP["RELIGIOUS_KEYS_PP<br/>33 base religious roles<br/>jobs_data_basic.py"]
RELIGIOUS_FEMALE_KEYS["RELIGIOUS_FEMALE_KEYS<br/>Female religious variants"]
BaseRoles["Base Roles:<br/>• christians → مسيحيون/مسيحيات<br/>• muslims → مسلمون/مسلمات<br/>• jews → يهود/يهوديات<br/>• buddhist → بوذيون/بوذيات"]
DenomRoles["Denomination Roles:<br/>• sunni muslim → مسلمون سنة<br/>• shi'a muslim → مسلمون شيعة<br/>• anglican → أنجليكيون"]
FunctionRoles["Functional Roles:<br/>• missionaries → مبشرون/مبشرات<br/>• monks → رهبان<br/>• nuns → راهبات<br/>• saints → قديسون/قديسات"]
BuildReligious["_build_religious_job_labels()<br/>Combines religions × roles"]

RELIGIOUS_KEYS_PP --> BuildReligious
RELIGIOUS_FEMALE_KEYS --> BuildReligious
BuildReligious --> BaseRoles
BuildReligious --> DenomRoles
BuildReligious --> FunctionRoles

subgraph subGraph2 ["Builder Functions"]
    BuildReligious
end

subgraph subGraph1 ["Religious Role Types"]
    BaseRoles
    DenomRoles
    FunctionRoles
end

subgraph subGraph0 ["Religious Data Sources"]
    RELIGIOUS_KEYS_PP
    RELIGIOUS_FEMALE_KEYS
end
```

**Example religious job combinations:**

| English Key | Male Arabic | Female Arabic |
| --- | --- | --- |
| `"christian missionaries"` | `"مبشرون مسيحيون"` | `"مبشرات مسيحيات"` |
| `"buddhist monks"` | `"رهبان بوذيون"` | `"راهبات بوذيات"` |
| `"muslim saints"` | `"قديسون مسلمون"` | `"قديسات مسلمات"` |

**Sources:** [ArWikiCats/translations/jobs/jobs_data_basic.py L20-L54](../ArWikiCats/translations/jobs/jobs_data_basic.py#L20-L54), [ArWikiCats/translations/jobs/jobs_data_basic.py L83-L98](../ArWikiCats/translations/jobs/jobs_data_basic.py#L83-L98)

### Sports-Related Jobs

The sports job system provides 571 sport job variants, integrating with the sports keys to create player, coach, and manager translations.

```mermaid
flowchart TD

SPORTS_KEYS["SPORTS_KEYS_FOR_JOBS<br/>431 sport keys<br/>'football' → 'كرة قدم'"]
FOOTBALL_KEYS["FOOTBALL_KEYS_PLAYERS<br/>46 football-specific roles<br/>Position-based labels"]
JOBS_PLAYERS["JOBS_PLAYERS<br/>145 player base roles<br/>'swimmers' → base label"]
TeamSports["TEAM_SPORT_LABELS<br/>31 team sport roles<br/>_build_team_sport_labels()"]
BoxingLabels["BOXING_LABELS<br/>42 weight classes<br/>_build_boxing_labels()"]
SkatingLabels["SKATING_LABELS<br/>4 skating disciplines<br/>_build_skating_labels()"]
GeneralScope["GENERAL_SCOPE_LABELS<br/>9 general sport roles<br/>_build_general_scope_labels()"]
SPORT_JOB_VARIANTS["SPORT_JOB_VARIANTS<br/>571 sport job variants<br/>Cached in JSON"]
PLAYERS_TO_MEN_WOMENS["PLAYERS_TO_MEN_WOMENS_JOBS<br/>1,342 combined player roles"]

SPORTS_KEYS --> SPORT_JOB_VARIANTS
FOOTBALL_KEYS --> SPORT_JOB_VARIANTS
JOBS_PLAYERS --> TeamSports
TeamSports --> PLAYERS_TO_MEN_WOMENS
BoxingLabels --> PLAYERS_TO_MEN_WOMENS
SkatingLabels --> PLAYERS_TO_MEN_WOMENS
GeneralScope --> PLAYERS_TO_MEN_WOMENS

subgraph subGraph2 ["Final Sport Jobs"]
    SPORT_JOB_VARIANTS
    PLAYERS_TO_MEN_WOMENS
end

subgraph subGraph1 ["Player Role Builders"]
    TeamSports
    BoxingLabels
    SkatingLabels
    GeneralScope
end

subgraph subGraph0 ["Sport Job Components"]
    SPORTS_KEYS
    FOOTBALL_KEYS
    JOBS_PLAYERS
end
```

**Sport job variant examples:**

| Variant Type | Example | Male Label | Female Label |
| --- | --- | --- | --- |
| Team sport player | `"basketball players"` | `"لاعبو كرة السلة"` | `"لاعبات كرة السلة"` |
| Boxing weight class | `"heavyweight boxers"` | `"ملاكمو وزن ثقيل"` | (not defined) |
| Sport manager | `"football managers"` | `"مدربو كرة قدم"` | `"مدربات كرة قدم"` |
| Olympic scope | `"olympic athletes"` | `"رياضيون أولمبيون"` | `"رياضيات أولمبيات"` |

**Sources:** [ArWikiCats/translations/jobs/jobs_players_list.py L1-L263](../ArWikiCats/translations/jobs/jobs_players_list.py#L1-L263), [_work_files/data_len.json L32-L46](../_work_files/data_len.json#L32-L46)

### Singer and Music Roles

Singer jobs combine musical professions with media types (film, television, radio, etc.) to create 432 distinct role mappings.

```mermaid
flowchart TD

SINGERS_TAB["SINGERS_TAB<br/>288 base singer entries<br/>singers_tab.json"]
FILMS_TYPE["FILMS_TYPE<br/>9 film/media types<br/>film, television, musical theatre"]
SINGERS_AFTER_ROLES["SINGERS_AFTER_ROLES<br/>24 role types<br/>musicians, composers, songwriters"]
NON_FICTION_TOPICS["NON_FICTION_TOPICS<br/>28 non-fiction topics<br/>environmental, medical, political"]
BuildSingerVariants["Build singer × media variants<br/>_add_singer_media_variants()"]
BuildNonFiction["Build non-fiction × role variants<br/>_add_non_fiction_variants()"]
MEN_WOMENS_SINGERS_BASED["MEN_WOMENS_SINGERS_BASED<br/>65 base singer roles<br/>From jobs_Men_Womens_Singers.json"]
MEN_WOMENS_SINGERS["MEN_WOMENS_SINGERS<br/>432 expanded singer roles<br/>Cached in JSON"]

SINGERS_TAB --> BuildSingerVariants
FILMS_TYPE --> BuildSingerVariants
SINGERS_AFTER_ROLES --> BuildSingerVariants
NON_FICTION_TOPICS --> BuildNonFiction
BuildSingerVariants --> MEN_WOMENS_SINGERS
BuildNonFiction --> MEN_WOMENS_SINGERS

subgraph subGraph2 ["Final Singer Datasets"]
    MEN_WOMENS_SINGERS_BASED
    MEN_WOMENS_SINGERS
    MEN_WOMENS_SINGERS_BASED --> MEN_WOMENS_SINGERS
end

subgraph subGraph1 ["Singer Builders"]
    BuildSingerVariants
    BuildNonFiction
end

subgraph subGraph0 ["Singer Data Components"]
    SINGERS_TAB
    FILMS_TYPE
    SINGERS_AFTER_ROLES
    NON_FICTION_TOPICS
end
```

**Singer role examples:**

| Category | Male Form | Female Form |
| --- | --- | --- |
| `"film musicians"` | `"موسيقيو أفلام"` | `"موسيقيات أفلام"` |
| `"television singers"` | `"مغنو تلفزيون"` | `"مغنيات تلفزيون"` |
| `"record producers"` | `"منتجو تسجيلات"` | `"منتجات تسجيلات"` |
| `"singer-songwriters"` | `"مغنون وكتاب أغاني"` | `"مغنيات وكاتبات أغاني"` |

**Sources:** [ArWikiCats/translations/jobs/jobs_singers.py L1-L148](../ArWikiCats/translations/jobs/jobs_singers.py#L1-L148), [_work_files/data_len.json L41-L64](../_work_files/data_len.json#L41-L64)

### Scientific Disciplines

The jobs system includes 193 scientific discipline translations organized by field.

**Scientific discipline categories:**

| Field | Example Disciplines | Arabic Pattern |
| --- | --- | --- |
| Life Sciences | `"biologists"`, `"zoologists"`, `"botanists"` | `"علماء {discipline}"` |
| Medical Sciences | `"epidemiologists"`, `"immunologists"`, `"virologists"` | `"علماء {discipline}"` |
| Physical Sciences | `"physicists"`, `"chemists"`, `"astronomers"` | `"فيزيائيون"`, `"كيميائيون"` |
| Earth Sciences | `"geologists"`, `"oceanographers"`, `"seismologists"` | `"علماء {discipline}"` |

**Sources:** [ArWikiCats/translations/jobs/Jobs2.py L21-L88](../ArWikiCats/translations/jobs/Jobs2.py#L21-L88)

### Painter and Artist Roles

Artist jobs combine art styles with role types to generate comprehensive painter labels.

```mermaid
flowchart TD

PAINTER_STYLES["PAINTER_STYLES<br/>5 art styles<br/>symbolist, romantic, etc."]
PAINTER_ROLES["PAINTER_ROLE_LABELS<br/>2 role types<br/>painters, artists"]
PAINTER_CATEGORIES["PAINTER_CATEGORY_LABELS<br/>10 subject categories<br/>landscape, portrait, etc."]
BuildPainter["_build_painter_job_labels()<br/>Combines styles × roles × subjects"]
PainterJobs["Painter job labels<br/>'romantic landscape painters'<br/>→ 'رسامو مناظر طبيعية رومانسيون'"]

PAINTER_STYLES --> BuildPainter
PAINTER_ROLES --> BuildPainter
PAINTER_CATEGORIES --> BuildPainter
BuildPainter --> PainterJobs

subgraph Output ["Output"]
    PainterJobs
end

subgraph Builder ["Builder"]
    BuildPainter
end

subgraph subGraph0 ["Artist Components"]
    PAINTER_STYLES
    PAINTER_ROLES
    PAINTER_CATEGORIES
end
```

**Sources:** [ArWikiCats/translations/jobs/jobs_data_basic.py L102-L126](../ArWikiCats/translations/jobs/jobs_data_basic.py#L102-L126)

## Company Founder Roles

The system includes 28 company founder role mappings organized by industry.

**Example company founder roles:**

| English Key | Male Label | Female Label |
| --- | --- | --- |
| `"technology company founders"` | `"مؤسسو شركات تقانة"` | `"مؤسسات شركات تقانة"` |
| `"media company founders"` | `"مؤسسو شركات إعلامية"` | `"مؤسسات شركات إعلامية"` |
| `"pharmaceutical company founders"` | `"مؤسسو شركات أدوية"` | `"مؤسسات شركات أدوية"` |

**Sources:** [ArWikiCats/translations/jobs/Jobs.py L32-L67](../ArWikiCats/translations/jobs/Jobs.py#L32-L67), [_work_files/data_len.json L114](../_work_files/data_len.json#L114)

## Integration with Resolvers

Jobs data integrates with nationality and country resolvers to create complex category translations combining location and occupation.

### Male Job Resolver Integration

```mermaid
flowchart TD

InputCategory["Input Category<br/>'british film directors'"]
NormalizeInput["fix_keys()<br/>Remove 'the', lowercase"]
LoadJobs["_load_jobs_data()<br/>jobs_mens_data → {ar_job}"]
LoadNats["_load_nat_data()<br/>All_Nat → {males}"]
LoadFormatted["_load_formatted_data()<br/>Template patterns"]
CreateBot["format_multi_data_v2()<br/>MultiDataFormatterBaseV2"]
Templates["Formatted patterns:<br/>'{en_nat} {en_job}' → '{ar_job} {males}'<br/>'{en_nat} expatriate {en_job}' → '{ar_job} {males} مغتربون'"]
SearchCategory["_bot.search_all_category()<br/>Pattern matching"]
ResolveResult["Result:<br/>'مخرجو أفلام بريطانيون'"]

NormalizeInput --> SearchCategory
LoadJobs --> CreateBot
LoadNats --> CreateBot
LoadFormatted --> CreateBot
CreateBot --> SearchCategory

subgraph Resolution ["Resolution"]
    SearchCategory
    ResolveResult
    SearchCategory --> ResolveResult
end

subgraph subGraph2 ["Formatter Creation"]
    CreateBot
    Templates
    Templates --> CreateBot
end

subgraph subGraph1 ["Data Loading"]
    LoadJobs
    LoadNats
    LoadFormatted
end

subgraph subGraph0 ["Input Processing"]
    InputCategory
    NormalizeInput
    InputCategory --> NormalizeInput
end
```

**Male resolver formatted patterns (226 templates):**

| Pattern Template | Arabic Output | Example |
| --- | --- | --- |
| `"{en_nat} {en_job}"` | `"{ar_job} {males}"` | `"british actors"` → `"ممثلون بريطانيون"` |
| `"{en_nat} expatriate {en_job}"` | `"{ar_job} {males} مغتربون"` | `"turkish expatriate footballers"` → `"لاعبو كرة قدم أتراك مغتربون"` |
| `"{en_nat} emigrants {en_job}"` | `"{ar_job} {males} مهاجرون"` | `"italian emigrants writers"` → `"كتاب إيطاليون مهاجرون"` |
| `"male {en_nat}"` | `"{males} ذكور"` | `"male american"` → `"أمريكيون ذكور"` |

**Sources:** [ArWikiCats/new_resolvers/jobs_resolvers/mens.py L114-L254](../ArWikiCats/new_resolvers/jobs_resolvers/mens.py#L114-L254), [ArWikiCats/new_resolvers/jobs_resolvers/mens.py L303-L325](../ArWikiCats/new_resolvers/jobs_resolvers/mens.py#L303-L325)

### Female Job Resolver Integration

```mermaid
flowchart TD

InputFemale["Input Category<br/>'british female actors'"]
CheckMale["Check mens_resolver_labels()<br/>Skip if male match found"]
Stage1["Stage 1: load_bot()<br/>Uses jobs_womens_data<br/>75,244 female job entries"]
Stage2["Stage 2: load_bot_only_womens()<br/>Uses FEMALE_JOBS_BASE_EXTENDED<br/>51 core female jobs"]
FemaleTemplates["Female patterns:<br/>'{en_nat} female {en_job}' → '{ar_job} {females}'<br/>'{en_nat} actresses' → 'ممثلات {females}'<br/>'female {en_nat}' → '{females}'"]
FemaleResult["Result:<br/>'ممثلات بريطانيات'"]

CheckMale --> Stage1
FemaleTemplates --> Stage1
FemaleTemplates --> Stage2
Stage2 --> FemaleResult

subgraph subGraph3 ["Resolution Output"]
    FemaleResult
end

subgraph subGraph2 ["Female Templates"]
    FemaleTemplates
end

subgraph subGraph1 ["Two-Stage Resolution"]
    Stage1
    Stage2
    Stage1 --> Stage2
end

subgraph subGraph0 ["Female Resolver Pipeline"]
    InputFemale
    CheckMale
    InputFemale --> CheckMale
end
```

**Female resolver formatted patterns:**

| Pattern Template | Arabic Output | Example |
| --- | --- | --- |
| `"{en_nat} female {en_job}"` | `"{ar_job} {females}"` | `"german female scientists"` → `"عالمات ألمانيات"` |
| `"{en_nat} actresses"` | `"ممثلات {females}"` | `"french actresses"` → `"ممثلات فرنسيات"` |
| `"female {en_nat} people"` | `"{females}"` | `"female british people"` → `"بريطانيات"` |
| `"female expatriate {en_job}"` | `"{ar_job} مغتربات"` | `"female expatriate nurses"` → `"ممرضات مغتربات"` |

**Sources:** [ArWikiCats/new_resolvers/jobs_resolvers/womens.py L91-L186](../ArWikiCats/new_resolvers/jobs_resolvers/womens.py#L91-L186), [ArWikiCats/new_resolvers/jobs_resolvers/womens.py L230-L278](../ArWikiCats/new_resolvers/jobs_resolvers/womens.py#L230-L278)

### Nationality-Before-Occupation Pattern

Certain job categories require nationality to precede occupation in Arabic for proper grammatical structure. The system maintains 17 base patterns in `NAT_BEFORE_OCC_BASE`.

**NAT_BEFORE_OCC pattern list:**

```
NAT_BEFORE_OCC_BASE = [
    "murdered abroad",
    "contemporary",
    "tour de france stage winners",
    "deafblind",
    "deaf",
    "blind",
    "jews",
    "women's rights activists",
    "female rights activists",
    "human rights activists",
    "imprisoned",
    "imprisoned abroad",
    "conservationists",
    "expatriate",
    "defectors",
    "scholars of islam",
    "scholars-of-islam",
    "amputees",
    "expatriates",
    "executed abroad",
    "emigrants",
]
```

**Extended with religious keys (total 54 patterns):**

* All entries from `RELIGIOUS_KEYS_PP` are added to create the full `NAT_BEFORE_OCC` list
* This ensures patterns like `"british muslims"` → `"بريطانيون مسلمون"` (nationality first)

**Sources:** [ArWikiCats/translations/jobs/jobs_data_basic.py L56-L82](../ArWikiCats/translations/jobs/jobs_data_basic.py#L56-L82), [_work_files/data_len.json L99](../_work_files/data_len.json#L99)

## Key Utilities

### Job Key Normalization

The `fix_keys()` function standardizes input categories before resolution:

**Normalization operations:**

1. Remove apostrophes: `"women's"` → `"womens"`
2. Convert to lowercase
3. Remove "the" prefix
4. Replace multi-space with single space
5. Map `"womens"` / `"women"` → `"female"`
6. Map `"expatriates"` → `"expatriate"`
7. Map `"canadian football"` → `"canadian-football"`

**Sources:** [ArWikiCats/new_resolvers/jobs_resolvers/utils.py L10-L26](../ArWikiCats/new_resolvers/jobs_resolvers/utils.py#L10-L26)

### Gender Key Filtering

The `is_false_key()` function prevents incorrect job classification:

**Filtering logic:**

* Skip keys containing `"mens"` or `"men's"` with Arabic label containing `"رجالية"` (men's sports equipment)
* Skip keys in `genders_keys` (status descriptors like `"executed"`, `"murdered abroad"`)
* Skip keys in `RELIGIOUS_KEYS_PP` (handled separately)
* Skip keys containing `"expatriate"` or `"immigrants"` without job context

**Sources:** [ArWikiCats/new_resolvers/jobs_resolvers/mens.py L89-L111](../ArWikiCats/new_resolvers/jobs_resolvers/mens.py#L89-L111), [ArWikiCats/new_resolvers/jobs_resolvers/womens.py L68-L87](../ArWikiCats/new_resolvers/jobs_resolvers/womens.py#L68-L87)

## Data Export Points

Jobs data exports through multiple layers for different use cases:

### Direct Exports

| Export | Source | Purpose |
| --- | --- | --- |
| `jobs_mens_data` | [ArWikiCats/translations/jobs/Jobs.py L181](../ArWikiCats/translations/jobs/Jobs.py#L181) | Primary male job resolver lookup |
| `jobs_womens_data` | [ArWikiCats/translations/jobs/Jobs.py L182](../ArWikiCats/translations/jobs/Jobs.py#L182) | Primary female job resolver lookup |
| `Jobs_new` | [ArWikiCats/translations/jobs/Jobs.py L183](../ArWikiCats/translations/jobs/Jobs.py#L183) | Extended jobs with nationality variants |
| `RELIGIOUS_KEYS_PP` | [ArWikiCats/translations/jobs/jobs_data_basic.py L20](../ArWikiCats/translations/jobs/jobs_data_basic.py#L20) | Religious role patterns |
| `SPORT_JOB_VARIANTS` | [ArWikiCats/translations/jobs/jobs_players_list.py L202](../ArWikiCats/translations/jobs/jobs_players_list.py#L202) | Sport-specific job variants |
| `short_womens_jobs` | [ArWikiCats/translations/jobs/jobs_womens.py L75](../ArWikiCats/translations/jobs/jobs_womens.py#L75) | Core female-specific jobs |

### Aggregate Exports

Via [ArWikiCats/translations/__init__.py L15-L26](../ArWikiCats/translations/__init__.py#L15-L26)

:

```python
from .jobs import (
    FEMALE_JOBS_BASE_EXTENDED,
    NAT_BEFORE_OCC,
    NAT_BEFORE_OCC_BASE,
    PLAYERS_TO_MEN_WOMENS_JOBS,
    RELIGIOUS_KEYS_PP,
    SPORT_JOB_VARIANTS,
    Jobs_new,
    jobs_mens_data,
    jobs_womens_data,
    short_womens_jobs,
)
```

**Sources:** [ArWikiCats/translations/__init__.py L15-L26](../ArWikiCats/translations/__init__.py#L15-L26), [ArWikiCats/translations/jobs/Jobs.py L206-L210](../ArWikiCats/translations/jobs/Jobs.py#L206-L210)

## Performance Characteristics

The jobs system uses extensive caching to optimize lookup performance:

### Caching Strategy

```mermaid
flowchart TD

BotCache["@functools.lru_cache(maxsize=1)<br/>On bot creation"]
LoadBotCache["load_bot()<br/>1-entry cache<br/>MultiDataFormatterBaseV2 instance"]
DataCache["@functools.lru_cache(maxsize=1)<br/>On data loaders"]
LoadJobsCache["_load_jobs_data()<br/>1-entry cache (constant)"]
LoadNatsCache["_load_nat_data()<br/>1-entry cache (constant)"]
LoadFormattedCache["_load_formatted_data()<br/>1-entry cache (constant)"]
ResolverCache["@functools.lru_cache(maxsize=10000)<br/>On resolver functions"]
MensCache["_mens_resolver_labels()<br/>10,000 entry cache"]
WomensCache["_womens_resolver_labels()<br/>10,000 entry cache"]

subgraph subGraph2 ["Bot Creation Cache"]
    BotCache
    LoadBotCache
    BotCache --> LoadBotCache
end

subgraph subGraph1 ["Data Load Cache"]
    DataCache
    LoadJobsCache
    LoadNatsCache
    LoadFormattedCache
    DataCache --> LoadJobsCache
    DataCache --> LoadNatsCache
    DataCache --> LoadFormattedCache
end

subgraph subGraph0 ["Resolver Cache"]
    ResolverCache
    MensCache
    WomensCache
    ResolverCache --> MensCache
    ResolverCache --> WomensCache
end
```

**Cache sizes:**

* Resolver functions: 10,000 entries each (mens, womens)
* Data loaders: 1 entry (singleton pattern)
* Bot instances: 1 entry (singleton pattern)

**Memory footprint:**

* `jobs_mens_data`: 3.7 MiB (97,797 entries)
* `jobs_womens_data`: 1.8 MiB (75,244 entries)
* Total jobs memory: ~5.5 MiB

**Sources:** [ArWikiCats/new_resolvers/jobs_resolvers/mens.py L114-L327](../ArWikiCats/new_resolvers/jobs_resolvers/mens.py#L114-L327), [ArWikiCats/new_resolvers/jobs_resolvers/womens.py L90-L302](../ArWikiCats/new_resolvers/jobs_resolvers/womens.py#L90-L302), [_work_files/data_len.json L9-L14](../_work_files/data_len.json#L9-L14)
