liveBook · Manning

Distributional semantics

As explained in AI-Powered Search

Distributional semantics is a linguistic and computational approach that represents word or phrase meaning through patterns of co-occurrence and contextual distribution.

A search for “pizza” is more likely to retrieve restaurant documents than car-rental documents. That surrounding content provides clues about what a term means. Distributional semantics uses this principle—the distributional hypothesis—that words appearing in similar contexts tend to have similar meanings. section 2.3

A search engine can construct contexts from matching document sets. Queries can select character patterns, nearby terms, or Boolean combinations; the resulting documents reveal associations that an isolated keyword cannot. Context can be examined at the level of phrases, fields, documents, document sets, and the corpus. section 2.3 section 2.7

Selecting a context

The query `(Microsoft OR MS) AND Word` selects documents containing “Word” alongside either “Microsoft” or “MS”. It gives “Word” a more specific document context than a search for that term alone. Likewise, `"VP Engineering"~2` matches nearby variants such as “VP of Engineering” and “Engineering VP”. section 2.3

Vectors provide another way to compare meaning. A sparse representation can give each indexed term a dimension marked present or absent. Dense embeddings instead use fewer dimensions to score shared attributes; cosine similarity can then sort items by similarity. For ranking, this offers a semantic signal beyond whether particular keywords occur or how often they occur. section 2.3 section 2.7

Figure 2.11 Similarity between embeddings. The cosine between vectors shows the items list sorted by similarity with “green tea”, with “cheese pizza”, and with “donut”.
figure

Compare the similarity orderings for “green tea”, “cheese pizza”, and “donut” to see how embedding-based comparisons change with the item being searched. section 2.3

How AI-Powered Search covers it

How deep it goes
Defines the distributional hypothesis and connects query-selected document sets to vectors and embeddings, without detailing a training procedure.
Examples
Uses pizza-related documents, executive-title queries, a Boolean query for “Word”, and illustrated embedding similarity rankings.
What it assumes
Defines the distributional hypothesis from scratch while using queries, documents, and inverted indexes as working vocabulary.
What you can do after
Evaluate/understand how document context and embedding similarity can reveal relationships beyond keyword occurrence.
How it connects
Connects inverted indexes and Boolean queries to embeddings, cosine similarity, and semantic search ranking.

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.