이스마엘

2025년 11월 10일 11:54분

package com.jesusbornd.genesis;
/*
 * Genesis_16_Chapter_Lv1_V2.java
 * [KO] 새 스타일: 창세기 16장 — 대표 4절(KRV+ESV) + 요약 + 적용
 * [EN] New style: Genesis 16 — 4 Key Verses (KRV+ESV) + Summary + Practice
 *
 * Variation (Java, V2):
 * 1) record Verse + Optional ESV 처리 (결측 대비)
 * 2) Functional style: List<Verse> -> Stream -> flatMap으로 라인 생성
 * 3) StringWriter/PrintWriter 버퍼에 한 번에 출력 (IO 추상)
 * 4) Objects.requireNonNullElse 로 안전 기본값 주기
 */

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import java.util.stream.Stream;

public class Genesis_16_Chapter_Lv1_V2 {

    // ---- Domain ----
    public record Verse(String ref, String krv, Optional<String> esv) {
        Stream<String> toLines() {
            String esvLine = Objects.requireNonNullElse(esv.orElse(null), "(ESV not provided)");
            return Stream.of(ref, "KRV: " + krv, "ESV: " + esvLine, "");
        }
    }

    // ---- Data: 16:1–2, 16:6, 16:13, 16:15 ----
    private static final List<Verse> VERSES = List.of(
        new Verse(
            "창세기 16:1–2 / Genesis 16:1–2",
            "사래가 아이를 낳지 못하므로 여종 하갈을 아브람에게 주어 그로 말미암아 자녀를 얻고자 하니",
            Optional.of("Sarai had no child; she gave her Egyptian servant Hagar to Abram to obtain children through her.")
        ),
        new Verse(
            "창세기 16:6 / Genesis 16:6",
            "사래가 하갈을 학대하였더니 하갈이 사래 앞에서 도망하였더라",
            Optional.of("Sarai dealt harshly with her, and she fled from her.")
        ),
        new Verse(
            "창세기 16:13 / Genesis 16:13",
            "하갈이 자기에게 이르신 여호와의 이름을 ‘엘 로이’라 하였으니 ‘나를 감찰하시는 하나님’을 보았다 함이라",
            Optional.of("She called the name of the LORD who spoke to her, “You are a God of seeing” (El Roi).")
        ),
        new Verse(
            "창세기 16:15 / Genesis 16:15",
            "하갈이 아브람에게 이스마엘을 낳으매",
            Optional.of("Hagar bore Abram a son, and Abram called the name of his son Ishmael.")
        )
    );

    // ---- Labels & texts ----
    private static final Map<String, String> LBL = Map.of(
        "TITLE_KO", "[창세기 16장 | KRV & ESV]",
        "TITLE_EN", "[Genesis 16 | KRV & ESV]",
        "SUMMARY",  "[요약 / Summary]",
        "PRACTICE", "[적용 / Practice]"
    );

    private static final String SUMMARY_KO =
        "사람의 계산으로 하갈을 통해 아들을 얻고자 하나(16:1–2), 상처와 도피가 뒤따른다(16:6). "
      + "그러나 하나님은 도망한 하갈을 ‘보시고’ 위로하시며(엘 로이, 16:13), 이스마엘의 탄생을 주권 안에서 이끄신다(16:15).";
    private static final String SUMMARY_EN =
        "Human scheming seeks a child through Hagar (16:1–2), resulting in hurt and flight (16:6). "
      + "Yet God sees and comforts the runaway (El Roi, 16:13) and sovereignly oversees Ishmael’s birth (16:15).";

    private static final String PRACTICE_KO =
        "내 ‘계산’ 대신 ‘보시는 하나님’을 신뢰하는 고백 1문장, 상처 난 관계를 위한 중보 1분, 도망이 아닌 순종의 한 걸음.";
    private static final String PRACTICE_EN =
        "Confess trust in the God who sees rather than your own schemes; intercede 1 minute for a wounded relationship; take one step of obedience, not escape.";

    public static void main(String[] args) {
        StringWriter sw = new StringWriter();
        try (PrintWriter out = new PrintWriter(sw)) {

            // Title
            out.println(LBL.get("TITLE_KO"));
            out.println(LBL.get("TITLE_EN"));
            out.println("Lv1: Human Schemes - Hurt & Flight - El Roi (God who sees) - Ishmael");
            out.println();

            // Verses
            VERSES.stream()
                  .flatMap(Verse::toLines)
                  .forEach(out::println);

            // Summary
            out.println(LBL.get("SUMMARY"));
            out.println("KO: " + SUMMARY_KO);
            out.println("EN: " + SUMMARY_EN);
            out.println();

            // Practice
            out.println(LBL.get("PRACTICE"));
            out.println("KO: " + PRACTICE_KO);
            out.println("EN: " + PRACTICE_EN);
        }

        System.out.print(sw.toString());
    }
}

#### Genesis_16_Chapter_Lv1_V2.py
#### [KO] 새 스타일: dispatcher(dict) + functools.partial 라벨러 + textwrap.fill + 하이라이트(El Roi)
#### [EN] New style: dispatcher(dict) + functools.partial labeler + textwrap.fill + highlight (El Roi)

from dataclasses import dataclass
from typing import List, Callable, Dict, Iterable
from functools import partial
import textwrap

WIDTH = 92

def wrap(s: str) -> str:
    return textwrap.fill(s, width=WIDTH)

def highlight(s: str) -> str:
    return (s.replace("엘 로이", "[엘 로이]")
             .replace("El Roi", "[El Roi]")
             .replace("God of seeing", "[God of seeing]"))

@dataclass(frozen=True)
class Verse:
    ref: str
    krv: str
    esv: str

VERSES: List[Verse] = [
    Verse("창세기 16:1–2 / Genesis 16:1–2",
          "사래가 아이를 낳지 못하여 여종 하갈을 아브람에게 주어 자녀를 얻고자 함",
          "Sarai had borne Abram no children; she gave Hagar to obtain children through her."),
    Verse("창세기 16:6 / Genesis 16:6",
          "사래가 하갈을 학대하매 하갈이 도망함",
          "Sarai dealt harshly with her, and she fled from her."),
    Verse("창세기 16:13 / Genesis 16:13",
          "하갈이 여호와를 ‘엘 로이’라 부름 — 나를 보시는 하나님",
          "She called the LORD, “El Roi” — “You are a God of seeing.”"),
    Verse("창세기 16:15 / Genesis 16:15",
          "하갈이 아브람에게 이스마엘을 낳음",
          "Hagar bore Abram a son, Ishmael."),
]

SUMMARY = {
    "KO": ("사람의 계산으로 하갈을 의지하자(16:1–2) 상처와 도피가 따랐으나(16:6), "
           "하나님은 도망한 자를 ‘보시고’ 위로하셨다(16:13). 결국 이스마엘의 탄생도 주권 안에 있다(16:15)."),
    "EN": ("Human scheming relied on Hagar (16:1–2), producing hurt and flight (16:6). "
           "Yet God saw and comforted the runaway (16:13); even Ishmael’s birth rests under His sovereignty (16:15).")
}

PRACTICE = {
    "KO": "‘보시는 하나님’에 대한 신뢰 고백 1문장 · 상처 난 관계를 위한 1분 중보 · 도피 대신 순종의 한 걸음.",
    "EN": "Confess trust in the God who sees; intercede one minute for a wounded relationship; step in obedience, not escape.",
}

# ---- Small labeler (partial) ----
def label(block: str, lang: str = "KO") -> str:
    table: Dict[str, Dict[str, str]] = {
        "title": {"KO": "[창세기 16장 | KRV & ESV]", "EN": "[Genesis 16 | KRV & ESV]"},
        "summary": {"KO": "[요약 / Summary]", "EN": "[Summary]"},
        "practice": {"KO": "[적용 / Practice]", "EN": "[Practice]"},
    }
    return table[block][lang]

title_ko = partial(label, "title", "KO")
title_en = partial(label, "title", "EN")

def lines_title() -> Iterable[str]:
    yield title_ko()
    yield title_en()
    yield "Lv1: Human Schemes - Hurt & Flight - El Roi (God who sees) - Ishmael"
    yield ""

def lines_verses() -> Iterable[str]:
    for v in VERSES:
        yield v.ref
        yield "KRV: " + wrap(highlight(v.krv))
        yield "ESV: " + wrap(highlight(v.esv))
        yield ""

def lines_summary() -> Iterable[str]:
    yield label("summary", "KO")
    yield "KO: " + wrap(SUMMARY["KO"])
    yield "EN: " + wrap(SUMMARY["EN"])
    yield ""

def lines_practice() -> Iterable[str]:
    yield label("practice", "KO")
    yield "KO: " + PRACTICE["KO"]
    yield "EN: " + PRACTICE["EN"]

# ---- Dispatcher ----
BLOCKS: Dict[str, Callable[[], Iterable[str]]] = {
    "title": lines_title,
    "verses": lines_verses,
    "summary": lines_summary,
    "practice": lines_practice,
}

def main() -> None:
    for key in ("title", "verses", "summary", "practice"):
        for line in BLOCKS[key]():
            print(line)

if __name__ == "__main__":
    main()

Comments

Avatar
 2025년 11월 10일 11:55분

“엘 로이 — ‘나를 보시는 하나님’이라는 고백이 참 마음에 와닿습니다. 사람의 계산 대신 주님의 시선을 배우게 됩니다.” 🌿



Search

← 목록으로