InkarSaleshovaSDU commited on
Commit
7224dc5
1 Parent(s): 664e907

validated ir.py

Browse files
Files changed (1) hide show
  1. ir.py +15 -0
ir.py CHANGED
@@ -27,3 +27,18 @@ class SearchEngine:
27
  most_similar_idx = np.argmax(similarity_scores)
28
 
29
  return self.prompts[most_similar_idx]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  most_similar_idx = np.argmax(similarity_scores)
28
 
29
  return self.prompts[most_similar_idx]
30
+
31
+
32
+ if __name__ == "__main__":
33
+ storage = SearchEngine()
34
+
35
+ storage.add("I love programming")
36
+ storage.add("You need to graduate")
37
+ storage.add("Library is open")
38
+
39
+ input_prompt = "I enjoy coding"
40
+ most_similar_prompt = storage.search(input_prompt)
41
+
42
+ print(f"Input Prompt: {input_prompt}")
43
+ print(f"Most Similar Prompt: {most_similar_prompt}")
44
+