A search for “driver” might mean a person operating a vehicle, a golf club, or software that enables hardware to work. Polysemy is the problem of a word or phrase having multiple possible meanings. In search, matching the spelling alone cannot tell which meaning fits a query or document. section 2.5.1
Ambiguity also affects joins across unstructured data. Two documents that mention the same name may refer to different people, so a shared phrase is not always a reliable entity link. Context is needed before combining references or interpreting a query. section 2.1.3
One query, two contexts
For “chef,” a cooking context yields terms such as kitchen and restaurant; a DevOps context yields Puppet, Ansible, and configuration. Both contexts score as related to the query. Keeping their related terms separate avoids treating every occurrence of “chef” as the same intent. section 6.2
One implementation uses a semantic knowledge graph to traverse from a query term to likely categories, then from each category to related terms. A Python call can select the context field, keyword field, result limits, and minimum occurrence count. Categories are scored against the query; keywords are scored against both the query and their category. section 6.2
Listing 6.2 Disambiguating query intent across different contexts
def print_query_disambigutaion(query,
context_field="category", context_limit=5,
keywords_field="body", keywords_limit=10, min_occurrences=5):
nodes_to_traverse = [{"field": keywords_field, #1
"values": [query]}, #1
{"field": context_field, #2
"min_occurrences": min_occurrences, #2
"limit": context_limit}, #2
{"field": keywords_field, #3
"min_occurrences": min_occurrences, #3
"limit": keywords_limit}] #3
traversal = skg.traverse(*nodes_to_traverse)
print_disambigutaions(query, traversal)
The Python listing shows the three traversal stages—query, category, and keywords—and exposes the limits and occurrence threshold used to control the result. section 6.2
A static synonym list that applies everywhere can mix meanings. Contextualized term lists offer a more targeted interpretation, but supporting every possible sense is not practical; even a few well-separated senses can help avoid misleading matches. section 2.5.1 section 6.2
