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
embeddingsextra) 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
|
Fetch, compute and persist the taxonomy; return its |
|
Load the built taxonomy (raises |
|
An embedder backed by a local sentence-transformers model (loaded now). |
|
Skill-relatedness edges ( |
|
Union of edge sets over disjoint id spaces (e.g. ESCO and O*NET). |
|
The |
|
All ESCO skills and occupations (with their skill links). |
|
O*NET technology and K/S/A nodes, and occupations (downloads ~13 MB once). |
|
Nodes and occupations from the bytes of an O*NET text-database archive. |
|
Case-, accent- and punctuation-insensitive form of a label, for matching. |
|
Directory of the built taxonomy: |
Classes
|
Lookup and adjacency over taxonomy nodes, edges and (optional) vectors. |
|
How close two skills are, with the evidence behind the number. |
|
A taxonomy node matched to a piece of text. |
|
One skill-like concept from a source taxonomy. |
|
An occupation and the skill nodes it requires or may use. |
- class hired.taxonomy.Match(node, score, how)[source]#
Bases:
objectA taxonomy node matched to a piece of text.
- class hired.taxonomy.Occupation(*, id, label, source, essential=<factory>, optional=<factory>)[source]#
Bases:
BaseModelAn occupation and the skill nodes it requires or may use.
- class hired.taxonomy.Proximity(a, b, score, graph, cosine, alpha, a_node=None, b_node=None, via=None)[source]#
Bases:
objectHow close two skills are, with the evidence behind the number.
- transferability(**kwargs)[source]#
The band
scorefalls in (seetransferability_band()).- Return type:
- 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:
objectLookup 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.
- 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_weightstimes their similarity totext: 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.scorestays 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'
- proximity(a, b, *, alpha=0.5)[source]#
Blended adjacency of two skill texts (or node ids).
- Return type:
- class hired.taxonomy.SkillNode(*, id, label, alt_labels=<factory>, source, kind='skill', reuse_level=None, uri=None)[source]#
Bases:
BaseModelOne skill-like concept from a source taxonomy.
- 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
metasummary.embeddings=True(or an explicitembedder) also stores one vector per node label.graph_kwargsgo torelatedness_edges().
- 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/OptionalSkilland a skill’sisEssential/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
FileNotFoundErrorwith the build hint).embedder="auto"uses the stored embedding model for query text when the taxonomy has vectors and theembeddingsextra is installed (loaded on first use); passNoneto compare stored vectors only, or any embedder.index_kwargsgo toSkillIndex(e.g.bridge_k).- Return type:
- hired.taxonomy.merge_edges(*edge_sets)[source]#
Union of edge sets over disjoint id spaces (e.g. ESCO and O*NET).
- 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:
- 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]]
Skill-relatedness edges (
SRin(min_score, 1]) from co-occurrence.
- 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).
- hired.taxonomy.taxonomy_dir(*subpaths, root=None, make=True)[source]#
Directory of the built taxonomy:
rootor<data root>/taxonomy.- Return type:
- hired.taxonomy.transferability_band(score, *, bands=((0.75, Transferability.DIRECT), (0.5, Transferability.CONTEXTUAL), (0.25, Transferability.FOUNDATIONAL)))[source]#
The
Transferabilityband a proximityscorefalls in.>>> transferability_band(0.8).value, transferability_band(0.1).value ('direct', 'limited')
- Return type:
Modules
Schemas and on-disk layout for the skills taxonomy (ESCO + O*NET). |
|
Build the skills taxonomy into the data root, and load it back as a |
|
The label-embedding seam (the |
|
Skill relatedness from occupational co-occurrence (pure Python, no numpy). |
|
Query a built skills taxonomy: resolve skill text, score adjacency (Axis A). |
|
Fetch the ESCO and O*NET taxonomies into |