The part of the formulation of the problem for finding word embeddings is very similar to the continuous bag of words model (Mikolov et al., 2013), with the main difference that a context document is added.
the resulting word vector representations u can naturally be used for distance computations by computing the cosine similarity or Euclidean distance between a pair of embeddings.