text: import scipy
  
  from melior_transformers.encoding.encoding_model import SentenceEncoder
  
  se = SentenceEncoder()
  
  # Corpus with example sentences
  corpus = [
      "A man is eating food.",
      "A man is eating a piece of bread.",
      "The girl is carrying a baby.",
      "A man is riding a horse.",
      "A woman is playing violin.",
      "Two men pushed carts through the woods.",
      "A man is riding a white horse on an enclosed ground.",
      "A monkey is playing drums.",
      "A cheetah is running behind its prey.",
  ]
  
  corpus_embeddings = se.encode(corpus)
  
  # Query sentences:
  queries = [
      "A man is eating pasta.",
      "Someone in a gorilla costume is playing a set of drums.",
      "A cheetah chases prey on across a field.",
  ]
  query_embeddings = se.encode(queries)
  
  # Find the closest 5 sentences of the corpus for each query sentence based on cosine similarity
  closest_n = 5
  for query, query_embedding in zip(queries, query_embeddings):
      distances = scipy.spatial.distance.cdist(
          [query_embedding], corpus_embeddings, "cosine"
      )[0]
  
      results = zip(range(len(distances)), distances)
      results = sorted(results, key=lambda x: x[1])
  
      print("\n\n======================\n\n")
      print("Query:", query)
      print("\nTop 5 most similar sentences in corpus:")
  
      for idx, distance in results[0:closest_n]:
          print(corpus[idx].strip(), "(Score: %.4f)" % (1 - distance))
  