hired.taxonomy#

Skills taxonomy (ESCO + O*NET) and skill adjacency for alignment’s Axis A.

Strengthens transfer distance beyond keyword match and LLM judgment with two signals, blended as alpha * cosine + (1 - alpha) * graph:

  • a relatedness graph learned from which skills occupations require together (ESCO occupation↔skill links, O*NET technology and K/S/A ratings) — pure Python;

  • label embeddings (the embeddings extra) for similarity and for skills absent from both taxonomies.

Nothing is vendored: build the taxonomy once into the data root, then query it:

from hired.taxonomy import build_skill_index, load_skill_index
build_skill_index()                 # or `hired build-skill-index`; tens of minutes
idx = load_skill_index()
idx.suggest_adjacency("PyTorch", ["TensorFlow", "Excel"])

ESCO (© European Union) and O*NET (USDOL/ETA) data are used under CC BY 4.0; see hired.taxonomy.base.ATTRIBUTION, written next to the data as NOTICE.md. Research basis: misc/docs/research/skills-taxonomy-and-adjacency.md.

Functions

build_skill_index(*[, sources, embeddings, ...])

Fetch, compute and persist the taxonomy; return its meta summary.

load_skill_index(*[, root, embedder])

Load the built taxonomy (raises FileNotFoundError with the build hint).

sentence_transformer_embedder([model_name, ...])

An embedder backed by a local sentence-transformers model (loaded now).

relatedness_edges(occupations, *[, ...])

Skill-relatedness edges (SR in (min_score, 1]) from co-occurrence.

merge_edges(*edge_sets)

Union of edge sets over disjoint id spaces (e.g. ESCO and O*NET).

transferability_band(score, *[, bands])

The Transferability band a proximity score falls in.

fetch_esco(*[, get_json, cache, page_size, ...])

All ESCO skills and occupations (with their skill links).

fetch_onet(*[, get_bytes, cache, version, ...])

O*NET technology and K/S/A nodes, and occupations (downloads ~13 MB once).

parse_onet_archive(data, *[, min_importance])

Nodes and occupations from the bytes of an O*NET text-database archive.

normalize_label(text)

Case-, accent- and punctuation-insensitive form of a label, for matching.

taxonomy_dir(*subpaths[, root, make])

Directory of the built taxonomy: root or <data root>/taxonomy.

Classes

SkillIndex(nodes, edges, *[, vectors, ...])

Lookup and adjacency over taxonomy nodes, edges and (optional) vectors.

Proximity(a, b, score, graph, cosine, alpha)

How close two skills are, with the evidence behind the number.

Match(node, score, how)

A taxonomy node matched to a piece of text.

SkillNode(*, id, label[, alt_labels, kind, ...])

One skill-like concept from a source taxonomy.

Occupation(*, id, label, source[, ...])

An occupation and the skill nodes it requires or may use.

class hired.taxonomy.Match(node, score, how)[source]#

Bases: object

A taxonomy node matched to a piece of text.

class hired.taxonomy.Occupation(*, id, label, source, essential=<factory>, optional=<factory>)[source]#

Bases: BaseModel

An occupation and the skill nodes it requires or may use.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class hired.taxonomy.Proximity(a, b, score, graph, cosine, alpha, a_node=None, b_node=None, via=None)[source]#

Bases: object

How close two skills are, with the evidence behind the number.

property basis: str#

One readable line of evidence, for a record’s adjacency_basis.

transferability(**kwargs)[source]#

The band score falls in (see transferability_band()).

Return type:

Transferability

class hired.taxonomy.SkillIndex(nodes, edges, *, vectors=None, vector_ids=None, embedder=None, meta=None, bridge_k=3, bridge_min_score=0.5, graph_trust=0.2, kind_weights=None)[source]#

Bases: object

Lookup and adjacency over taxonomy nodes, edges and (optional) vectors.

>>> from hired.taxonomy.base import SkillNode
>>> nodes = [SkillNode(id='s:py', label='Python (computer programming)',
...                    alt_labels=['Python'], source='s'),
...          SkillNode(id='s:ml', label='machine learning', source='s'),
...          SkillNode(id='s:cook', label='cooking', source='s')]
>>> idx = SkillIndex(nodes, {'s:py': [('s:ml', 0.6)], 's:ml': [('s:py', 0.6)]})
>>> idx.lookup('python')[0].node.id
's:py'
>>> p = idx.proximity('Python', 'machine learning')
>>> p.score, p.alpha, p.transferability().value
(0.6, 0.0, 'contextual')
>>> idx.proximity('Python', 'cooking').score
0.0
graph_score(a_id, b_id)[source]#

Relatedness of two nodes (direct, or via one shared neighbour) and the via id.

Equivalent nodes count fully; cross-source bridges count with their weight.

Return type:

tuple[float, str | None]

lookup(text, *, k=5, min_score=0.5)[source]#

Nodes best matching text: exact label, alt label, token overlap, embedding.

Token and embedding matches are ranked by kind_weights times their similarity to text: the label embedding’s cosine when vectors exist (so a token overlap that is only a shared word ranks low), else the token score. Match.score stays the stage’s own score.

>>> from hired.taxonomy.base import SkillNode
>>> idx = SkillIndex([
...     SkillNode(id='o:s', label='Sales software', source='o', kind='technology'),
...     SkillNode(id='e:s', label='sales activities', source='e'),
... ], {})
>>> idx.resolve('sales').label
'sales activities'
Return type:

list[Match]

neighbors(text, *, k=10)[source]#

The skills most related to text in the co-occurrence graph.

Return type:

list[tuple[SkillNode, float]]

proximity(a, b, *, alpha=0.5)[source]#

Blended adjacency of two skill texts (or node ids).

Return type:

Proximity

resolve(text, *, min_score=0.5)[source]#

The single best node for text (or None).

Return type:

SkillNode | None

suggest_adjacency(requirement, candidate_skills, *, k=3, alpha=0.5)[source]#

The candidate’s skills closest to requirement, strongest first.

Return type:

list[Proximity]

class hired.taxonomy.SkillNode(*, id, label, alt_labels=<factory>, source, kind='skill', reuse_level=None, uri=None)[source]#

Bases: BaseModel

One skill-like concept from a source taxonomy.

kind: str#

“skill”, “knowledge”, “ability”, “technology”, “competence”, …

Type:

KSAO kind

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

reuse_level: str | None#

ESCO skill-reuse level (“transversal”, “cross-sector”, “sector-specific”, “occupation-specific”), when known — a transferability hint.

hired.taxonomy.build_skill_index(*, sources=('esco', 'onet'), embeddings=False, embedder=None, embedding_model='sentence-transformers/all-MiniLM-L6-v2', root=None, refresh=False, onet_version='30_0', graph_kwargs=None, get_json=None, get_bytes=None, progress=None)[source]#

Fetch, compute and persist the taxonomy; return its meta summary.

embeddings=True (or an explicit embedder) also stores one vector per node label. graph_kwargs go to relatedness_edges().

Return type:

dict[str, Any]

hired.taxonomy.fetch_esco(*, get_json=None, cache=None, page_size=100, language='en', progress=None)[source]#

All ESCO skills and occupations (with their skill links).

Occupation↔skill links are the union of both sides — an occupation’s hasEssential/OptionalSkill and a skill’s isEssential/OptionalForOccupation — so a record that only came back in brief form still gets its links.

Return type:

tuple[list[SkillNode], list[Occupation]]

hired.taxonomy.fetch_onet(*, get_bytes=None, cache=None, version='30_0', min_importance=3.5, progress=None)[source]#

O*NET technology and K/S/A nodes, and occupations (downloads ~13 MB once).

Return type:

tuple[list[SkillNode], list[Occupation]]

hired.taxonomy.load_skill_index(*, root=None, embedder='auto', **index_kwargs)[source]#

Load the built taxonomy (raises FileNotFoundError with the build hint).

embedder="auto" uses the stored embedding model for query text when the taxonomy has vectors and the embeddings extra is installed (loaded on first use); pass None to compare stored vectors only, or any embedder. index_kwargs go to SkillIndex (e.g. bridge_k).

Return type:

SkillIndex

hired.taxonomy.merge_edges(*edge_sets)[source]#

Union of edge sets over disjoint id spaces (e.g. ESCO and O*NET).

Return type:

dict[str, list[tuple[str, float]]]

hired.taxonomy.normalize_label(text)[source]#

Case-, accent- and punctuation-insensitive form of a label, for matching.

>>> normalize_label('  Machine-Learning (ML)! ')
'machine learning ml'
>>> normalize_label('Café')
'cafe'
Return type:

str

hired.taxonomy.parse_onet_archive(data, *, min_importance=3.5)[source]#

Nodes and occupations from the bytes of an O*NET text-database archive.

Return type:

tuple[list[SkillNode], list[Occupation]]

hired.taxonomy.relatedness_edges(occupations, *, optional_weight=0.5, min_cooccurrence=2.0, top_k=30, min_score=0.0)[source]#

Skill-relatedness edges (SR in (min_score, 1]) from co-occurrence.

Return type:

dict[str, list[tuple[str, float]]]

hired.taxonomy.sentence_transformer_embedder(model_name='sentence-transformers/all-MiniLM-L6-v2', *, batch_size=256)[source]#

An embedder backed by a local sentence-transformers model (loaded now).

Return type:

Callable[[Sequence[str]], Any]

hired.taxonomy.taxonomy_dir(*subpaths, root=None, make=True)[source]#

Directory of the built taxonomy: root or <data root>/taxonomy.

Return type:

str

hired.taxonomy.transferability_band(score, *, bands=((0.75, Transferability.DIRECT), (0.5, Transferability.CONTEXTUAL), (0.25, Transferability.FOUNDATIONAL)))[source]#

The Transferability band a proximity score falls in.

>>> transferability_band(0.8).value, transferability_band(0.1).value
('direct', 'limited')
Return type:

Transferability

Modules

base

Schemas and on-disk layout for the skills taxonomy (ESCO + O*NET).

build

Build the skills taxonomy into the data root, and load it back as a SkillIndex.

embed

The label-embedding seam (the embeddings extra).

graph

Skill relatedness from occupational co-occurrence (pure Python, no numpy).

index

Query a built skills taxonomy: resolve skill text, score adjacency (Axis A).

sources

Fetch the ESCO and O*NET taxonomies into SkillNode / Occupation.