You can convert Japanese characters to Romaji by using this module.
pip install pykakasi
from pykakasi import kakasi
kakasi = kakasi()
def jp2rome(text):
kakasi.setMode("H", "a") # Hiragana to ascii
kakasi.setMode("K", "a") # Katakana to ascii
kakasi.setMode("J", "a") # Japanese(kanji) to ascii
kakasi.setMode("r", "Hepburn") # Use Hepburn romanization
conv = kakasi.getConverter()
result = conv.do(text)
return(result)
jp2rome("Tesuto")
→'tesuto'
jp2rome("test")
→'tesuto'
jp2rome("test")
→'shiken'