import os import re import requests import json import numpy as np import pandas as pd from bs4 import BeautifulSoup from database import execute_query from aksharamukha import transliterate from sentence_transformers import util from llama_index.embeddings.nomic import NomicEmbedding nomic_api_key = os.getenv('NOMIC_API_KEY') #nomic embed model used for similarity scores nomic_embed_model = NomicEmbedding( api_key=nomic_api_key, dimensionality=128, model_name="nomic-embed-text-v1.5", ) def get_list_meaning_word(word): pada_meanings = {'pada': word, 'Monier-Williams Sanskrit-English Dictionary (1899)': [], 'Shabda-Sagara (1900)': [], 'Apte-Practical Sanskrit-English Dictionary (1890)': [], } url = f"https://ambuda.org/tools/dictionaries/mw,shabdasagara,apte/{word}" try: # Fetch HTML content response = requests.get(url) response.raise_for_status() # Parse HTML with BeautifulSoup soup = BeautifulSoup(response.text, 'html.parser') # Extracting text from different tags divs = soup.find_all('div', class_='my-4', attrs={'x-show': 'show'}) try: # Find all list items
  • within the specified