title: How to obtain SentenceTransformer vocab from corpus or query?
body: <p>I am trying <code>SentenceTransformer</code> model from <a href="https://www.sbert.net/docs/package_reference/SentenceTransformer.html" rel="nofollow noreferrer">SBERT.net</a> and I want to know how it handles entity names. Are they marked as unknown - are they broken down with tokens, etc. I want to make sure they are used in the comparison.</p>
  <p>However, to do that I would need to see the vocab it build for the query - and perhaps even convert an embedding to text.</p>
  <p>Looking at the api - its not obvious to me how to do that.</p>
  <p>Here is a quick example from their docs:</p>
  <pre><code>embedder = SentenceTransformer(&quot;all-MiniLM-L6-v2&quot;)
  
  corpus = [
      &quot;A man is eating food.&quot;,
      &quot;A man is eating a piece of bread.&quot;,
      &quot;The girl is carrying a baby.&quot;
  ]
  corpus_embeddings = embedder.encode(corpus, convert_to_tensor=True)
  
  # Query sentences:
  queries = [
      &quot;A man is eating pasta.&quot;
  ]
  
  top_k = min(5, len(corpus))
  for query in queries:
      query_embedding = embedder.encode(query, convert_to_tensor=True)
      ...
  </code></pre>