import sys import os sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from app.services.translation.indictrans_service import IndicTransTranslationService service = IndicTransTranslationService() service.load_model() p1 = "The popular voice speaks about the landowners, Mafia people, and the representatives of the" # Let's try stripping trailing prepositions/determiners: 'of the', 'the', etc. p1_clean = "The popular voice speaks about the landowners, Mafia people, and the representatives" p2 = "conservative parties and their names are known by everyone." # Let's try capitalizing the first letter p2_clean = p2[0].upper() + p2[1:] print("Original p1:", service.translate(p1, "en", "ta").encode("utf-8")) print("Cleaned p1:", service.translate(p1_clean, "en", "ta").encode("utf-8")) print("Original p2:", service.translate(p2, "en", "ta").encode("utf-8")) print("Cleaned p2:", service.translate(p2_clean, "en", "ta").encode("utf-8"))