I am developing a language learning tool in Python that generates dual-language books intended to be read as audio books. The system should work by giving single word translations after every significant part of speech (verb, noun and adjective) that it is meant to translate. So let's say you know English and you want to learn Spanish. This tool takes a Spanish novel and copies it but after each verb, noun and adjective the translated English word is given.
I've learned that it isn't practical to do this using a traditional black-box machine learning model since those rely on context that is not available when being passed individual parts of speech.
So I am wondering what is an optimal method for translating these parts of speech with minimal ambiguity?