hired.taxonomy.index#
Query a built skills taxonomy: resolve skill text, score adjacency (Axis A).
SkillIndex answers *how close is the candidate’s skill X to the job’s
requirement Y?* by blending two signals:
proximity = alpha * cosine(label vectors) + (1 - alpha) * graph relatedness
graph relatedness (always available): the co-occurrence
SRscore ofhired.taxonomy.graph, direct or through one shared neighbour (theviaskill, which makes a readable adjacency basis). Labels that name the same concept in ESCO and O*NET are treated as one node.cosine (with the
embeddingsextra): similarity of label embeddings, which also covers skills absent from both taxonomies. Without vectors,alphais effectively 0 and the score is graph-only —Proximityrecords thealphaactually used.bridges across sources: the ESCO and O*NET graphs share no occupations, so a node is also linked to its closest connected nodes in the other sources (label token overlap or embedding similarity, whichever is higher), weighted by that closeness. Graph relatedness then propagates through the bridge.
graph trust: a graph score of 0 (no path among each node’s strongest links) is missing evidence more often than unrelatedness, so cosine’s weight grows as the graph evidence weakens:
alphais used as given from a graph score ofgraph_trustup, and rises linearly to 1 (cosine alone) at a graph score of 0, so weak evidence never ranks below none.
The index suggests; the analyst (skill or LLM) still decides the record’s
match_type / transferability. SkillIndex.suggest_adjacency() ranks
the candidate’s skills against one requirement and proposes a
Transferability band for each.
Module Attributes
Score floors for each transferability band, strongest first; below the last, |
Functions
|
The |
Classes
|
A taxonomy node matched to a piece of text. |
|
How close two skills are, with the evidence behind the number. |
|
Lookup and adjacency over taxonomy nodes, edges and (optional) vectors. |
- hired.taxonomy.index.DFLT_KIND_WEIGHTS: dict[str, float] = {'technology': 0.8}#
Score floors for each transferability band, strongest first; below the last,
LIMITED. Keyword-overridable wherever bands are used. Calibrated on the real ESCO + O*NET build (MiniLM vectors, #10): clearly unrelated pairs (cooking~Python, welding~accounting, carpentry~software testing) score 0.06-0.11 and loosely related ones 0.2; Python~machine learning 0.27, Excel~financial analysis 0.39, TensorFlow~deep learning 0.54, SQL~data analytics 0.63, Java~Python 0.66. Ranking weight of a node’skindwhen free text resolves by token overlap or embedding (exact label matches are unaffected): a short query such as “sales” or “deep learning” names a skill more often than a product, so O*NET technology nodes (“Sales software”, “NeuralWare”) rank behind skill/knowledge nodes (#58).
- class hired.taxonomy.index.Match(node, score, how)[source]#
Bases:
objectA taxonomy node matched to a piece of text.
- class hired.taxonomy.index.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.index.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:
- hired.taxonomy.index.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: