Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ramsrigouthamg/5e388c8661cc2bfd02edcb7aeaed0612 to your computer and use it in GitHub Desktop.

Select an option

Save ramsrigouthamg/5e388c8661cc2bfd02edcb7aeaed0612 to your computer and use it in GitHub Desktop.
!pip install --quiet sentence_transformers==2.2.0
from sentence_transformers import SentenceTransformer
model= SentenceTransformer('all-MiniLM-L12-v2')
def get_answer_and_distractor_embeddings(answer,candidate_distractors):
answer_embedding = model.encode([answer])
distractor_embeddings = model.encode(candidate_distractors)
return answer_embedding,distractor_embeddings
distractors.insert(0,originalword)
print (distractors)
answer_embedd, distractor_embedds = get_answer_and_distractor_embeddings(originalword,distractors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment