liveBook · Manning

Polysemy

As explained in AI-Powered Search

Polysemy is the linguistic phenomenon in which a word or phrase has multiple related meanings that depend on usage and context.

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

How AI-Powered Search covers it

How deep it goes
Defines the problem and works through category-to-term graph traversal, while acknowledging that exhaustive sense coverage is impractical.
Examples
Uses ambiguous names and the queries “driver,” “server,” and “chef” to contrast possible meanings and contextualized terms.
What it assumes
Assumes a semantic knowledge graph with query terms, category and keyword fields, and query classification; defines polysemy before applying them.
What you can do after
Apply it via a semantic knowledge graph to produce category-specific related terms for ambiguous queries.
How it connects
Connects entity resolution, synonym lists, query-sense disambiguation, and semantic knowledge graphs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI-Powered Search. The section links point to the parts of the book it draws on.