Views
No views yet
pip install sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Load the model
4model = SentenceTransformer('anuragwagh0/marathlish-minilm')
5
6# Encode sentences
7sentences = ["Mala loan hava ahe", "I want a loan"]
8embeddings = model.encode(sentences)
9
10print(embeddings.shape)
11# Output: (2, 384) -> Two sentences, each is a vector of size 3841from sentence_transformers import SentenceTransformer, util
2
3model = SentenceTransformer('anuragwagh0/marathlish-minilm')
4
5# 1. Define your App's Capabilities (The "Targets")
6app_actions = [
7 "Check Account Balance",
8 "Transfer Money",
9 "Call Customer Support"
10]
11
12# 2. Encode your actions (Do this once on startup)
13action_vectors = model.encode(app_actions)
14
15# 3. Simulate a User Query
16user_query = "Bhau paise pathvayche" # Marathlish Input
17query_vector = model.encode(user_query)
18
19# 4. Find the best match
20scores = util.cos_sim(query_vector, action_vectors)[0]
21best_match_idx = scores.argmax()
22best_action = app_actions[best_match_idx]
23
24print(f"User said: '{user_query}'")
25print(f"Bot Action: {best_action}")
26# Output: Bot Action: Transfer Moneyall-MiniLM-L6-v2 (Lightweight, ~80MB)sentence-transformers on a synthetic dataset of 5000+ banking, tech support, and casual conversation pairs.