Sparse lexical expansion improves search by adding related, weighted terms to a query’s sparse vector of lexical features. A semantic knowledge graph can generate these terms without additional dataset fine-tuning, allowing documents with similar wording to match. section 5.4.5
A practical expansion pipeline:
- Start with a query term and traverse a semantic knowledge graph to find related nodes and their relatedness scores. section 5.4.5
- Convert relatedness scores into boosted lexical terms, preserving a stronger weight for the original query. section 5.4.5
- Choose whether expansion broadens recall, increases precision, preserves recall, or only improves ranking through query boosts and minimum-match settings. section 5.4.5
Expanding “vibranium”
A graph traversal returns wakandan, adamantium, wakanda, alloy, and other related terms. The expanded query boosts vibranium to 5 and assigns lower weights such as wakandan^0.8197 and adamantium^0.80724. section 5.4.5
Listing 5.5 Discovering context for the unknown term “vibranium”
stackexchange_skg = get_skg(engine.get_collection("stackexchange"))
query = "vibranium"
nodes_to_traverse = [{"field": "body", "values": [query]},
{"field": "body", "min_occurrences": 2, "limit": 8}]
traversal = stackexchange_skg.traverse(*nodes_to_traverse)
print_graph(traversal, query)
Shows the Python-style traversal that discovers contextual terms for an initially obscure query node. section 5.4.5
