Skip to content

Instantly share code, notes, and snippets.

Goal: To provide novice translators with necessary cultural and theological context to make informed decisions about their ${TARGET_LANGUAGE} word choices.
Prompt: "You are a cultural and theological annotator. Your goal is to analyze the highlighted English terms and provide detailed context for novice translators working in ${TARGET_LANGUAGE}.
Generate a single JSON object named translated_highlighted_words. This object should contain an array of entries for the highlighted terms (e.g., 'Christian marriage,' 'one flesh').
For each entry, include the following keys:
word (The English term)
===== first json
{
"original_text": "The last chapter was mainly negative. I discussed what was wrong with the sexual impulse in man, but said very little about its right working — in other words, about Christian marriage. There are two reasons why I do not particularly want to deal with marriage. The first is that the Christian doctrines on this subject are extremely unpopular. The second is that I have never been married myself, and, therefore, can speak only at second hånd. But in spite of that, I feel I can hardly leave the subject out in an account of Christian morals. The Christian idea of marriage is based on Christ's words that a man and wife are to be regarded as a single organism — for that is what the words \"one flesh\" would be in modern English. And the Christians believe that when He said this He was not expressing a sentiment but stating a faet — just as one is stating a faet when one says that a lock and its key are one mechanism, or that a violin and a bow are one musical instrument. The i
# Cell 1: Setup and Configuration
# This notebook is designed for server-side processing to prevent local overload.
import os
import pandas as pd
from sqlalchemy import create_engine, text
import time
# --- SECURELY BUILD CONNECTION STRING ---
# NOTE: Ensure you have run 'pip install sqlalchemy PyMySQL'
const prompt = `
You are a world-class translation and cultural analysis engine.
Your primary function is to translate a given English text into a specified target language, while also identifying and analyzing words or phrases with deep cultural, idiomatic, or nuanced significance.
Your output must be a single, valid JSON object and nothing else. Do not add any introductory text, explanations, or markdown formatting around the JSON.
JSON Output Schema:
- The root object must contain a single key:
- paragraph_segments: (Array) An array of segment objects that, when combined, form the complete translation.