@@ -21,13 +21,13 @@ import scala.util.{Failure, Success}
2121 * - Continuously write translated blocks to target file
2222 * *
2323 * Usage:
24- * - Wire Params
25- * - Add API_KEY in [[AnthropicCompletions ]], [[OpenAICompletions ]] and then run this class
24+ * - Wire Params, eg sourceFilePath
25+ * - Decide, whether to use context info to streamline translation
26+ * - Add API_KEY in [[AnthropicCompletions ]], [[OpenAICompletions ]] and then run this class
2627 * - Scan log for WARN log messages and improve corresponding blocks in target file manually
2728 *
2829 * Remarks:
2930 * - Numerical block headers in the .srt files are not interpreted, only timestamps matter
30- * . - Default params are just example values
3131 *
3232 * Similar to: [[sample.stream.SessionWindow ]]
3333 */
@@ -37,14 +37,15 @@ object SubtitleTranslator extends App {
3737 implicit val executionContext : ExecutionContextExecutor = system.dispatcher
3838
3939 // Params
40- private val sourceFilePath = " Killers .Of.The.Flower.Moon.2023.720p.WEBRip.x264.AAC-[YTS.MX] .srt"
41- private val targetFilePath = " DE_NEW_Killers .Of.The.Flower.Moon.2023.720p.WEBRip.x264.AAC-[YTS.MX] .srt"
40+ private val sourceFilePath = " EN_Killers .Of.The.Flower.Moon.srt"
41+ private val targetFilePath = " DE_Killers .Of.The.Flower.Moon.srt"
4242 private val targetLanguage = " German"
4343 private val movieTitle = " Killers of the Flower Moon"
4444 private val movieReleaseYear = 2023
4545
46- private val defaultModel = OpenAICompletions .withContext(movieTitle, movieReleaseYear)
47- private val fallbackModel = AnthropicCompletions .withContext(movieTitle, movieReleaseYear)
46+ private val useContext = true
47+ private val defaultModel = if (useContext) OpenAICompletions .withContext(movieTitle, movieReleaseYear) else new OpenAICompletions ()
48+ private val fallbackModel = if (useContext) AnthropicCompletions .withContext(movieTitle, movieReleaseYear) else new AnthropicCompletions ()
4849
4950 private val maxGapSeconds = 1 // gap time between two scenes (= session windows)
5051 private val endLineTag = " \n "
0 commit comments