BACKGROUND

In recent years, software engineers have developed machine translation systems to analyze various texts and automatically generate translations of such texts. For example, some machine translation systems generate term-by-term translations of text entered into websites, subtitles for videos, and news articles. In some such cases, conventional machine translation systems translate each term in a text from a source language to a target language without reference to surrounding text or with reference to a term's surrounding text. Despite quickly generating such translations, conventional machine translation systems often inaccurately translate texts. By primarily analyzing a text in a source language, conventional machine-translation systems routinely mistranslate homonyms, idiomatic expressions, or slang in video subtitles and other texts from a source language to a target language. To take but a few examples, some conventional machine-translation systems translate terms of endearment like “pumpkin” or “honey” to food rather than to an analogous terms of endearment in a target language.

SUMMARY

This disclosure describes embodiments of methods, non-transitory computer readable media, and systems that can generate contextual identifiers indicating context for frames of a video and utilize those contextual identifiers to generate translations of text corresponding to such video frames. By analyzing a digital video file, in some implementations, the disclosed systems identify video frames corresponding to a scene and a term sequence corresponding to a subset of the video frames. Based on images features of the video frames corresponding to the scene, the disclosed systems utilize a contextual neural network to generate a contextual identifier (e.g. a contextual tag) indicating context for the video frames. Based on the contextual identifier, the disclosed systems subsequently apply a translation neural network to generate a translation of the term sequence from a source language to a target language. In some cases, the translation neural network also generates affinity scores for the translation, where such an affinity score reflects an affinity between the contextual identifier relied upon for the translation and a translated term, a translated phrase, or other portion of the translation.

