An embedding is a numerical vector that represents aspects of a word’s meaning, so a computer can compare words and perform mathematical operations on them. The same approach can represent sentences and paragraphs. An encoder or vectorizer turns text into a numerical representation. section 1.1.1 section 6.2
Think of a word vector as an unlabeled list of attributes: each number occupies a consistent position, so corresponding entries line up when vectors are combined. In an embedding space, words that are closer together tend to be more similar in meaning. The individual entries need not have simple labels like the attributes on a character sheet. section 6.0 section 6.2.1
>>> from nessvec.indexers import Index #1
>>> index = Index(num_vecs=100_000) #2
>>> index.get_nearest("Engineer").round(2)
Engineer 0.00
engineer 0.23
Engineers 0.27
Engineering 0.30
Architect 0.35
engineers 0.36
Technician 0.36
Programmer 0.39
Consultant 0.39
Scientist 0.39
This Python example uses a nessvec index to find neighbors of “Engineer.” The results include related occupations as well as spelling and capitalization variants. section 6.2.1
Word2Vec learns word representations from local context: words occurring near one another provide training signals without a dictionary or manually labeled definitions. Training starts with a large collection of text, tokenized and segmented into sentences; small neighborhoods of words supply the context. section 6.2.4
Not every text vector is an embedding. A bag-of-words vector counts vocabulary items, while TF–IDF weights terms for retrieval. These representations are useful, but their word-count features differ from embeddings that support comparisons of meaning. Bag-of-words also discards word order, which can matter for logical relationships. section 1.1.1 section 1.7
Search and analogy
For semantic search, a query and candidate questions can be represented as vectors and compared to find a related question. In one FAQ example, a query about decreasing overfitting matches a question about reducing it. Word-vector arithmetic can also express an analogy: subtract the vector for germs from Louis Pasteur’s vector, then add the vector for physics. Such operations are useful experiments, not guarantees of a correct answer; an answer must be in the vocabulary. section 4.9 section 6.2.3
Choose the representation for the task, and test its results. A plausible match or analogy does not mean that a chatbot is generally intelligent; embeddings give software a way to calculate with patterns in language, not a guarantee of reliable understanding. section 1.5.3 section 6.2.5


















































