Created
May 1, 2022 18:54
-
-
Save ramsrigouthamg/5e388c8661cc2bfd02edcb7aeaed0612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !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