Created
September 18, 2024 19:19
-
-
Save ryderwishart/b90d01a8b14475194a86b5ac73ba6845 to your computer and use it in GitHub Desktop.
Generate UnfoldingWord translation notes with DSPy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Generate translation notes for each verse in the bible using DSPy\n", | |
"\n", | |
"What does this notebook do?\n", | |
"\n", | |
"We wanted to try using LLMs to generate translation notes for each verse in the bible, following the style of UnfoldingWord's current translation notes.\n", | |
"\n", | |
"As inputs, we have:\n", | |
"- a corpus of translation notes from UnfoldingWord (for examples)\n", | |
"- a set of possible classifications of the figures of speech (from translation note templates)\n", | |
"- a verse from the bible (e.g. \"For God so loved the world, that he gave his only Son, that whoever believes in him should not perish but have eternal life.\")\n", | |
"\n", | |
"The notebook uses DSPy to:\n", | |
"- retrieve relevant paragraphs from the TN\n", | |
"- classify the figures of speech in the verse\n", | |
"- synthesize a new note with commentary on the classification\n", | |
"\n", | |
"## Data examples\n", | |
"\n", | |
"Translation note templates:\n", | |
"\n", | |
"```tsv\n", | |
"figs-123person\t(Speaker) is speaking about himself in the third person. If this would not be natural in your language, you could use the first person form. Alternate translation: “text” \t\n", | |
"figs-abstractnouns\tIf your language does not use an abstract noun for the idea of **text**, you could express the same idea in another way. Alternate translation: “text”\t\n", | |
"figs-activepassive\tIf your language does not use this passive form, you could express the idea in active form or in another way that is natural in your language. Alternate translation: “text”\t\n", | |
"...etc.\n", | |
"```\n", | |
"\n", | |
"Existing translation notes from [unfoldingWord® Translation Notes (UTN)](https://www.unfoldingword.org/utn).\n", | |
"\n", | |
"## What do you need to run this notebook?\n", | |
"\n", | |
"- a CSV file with the bible in it, with the fields `vref` and `content`\n", | |
"- a set of templates for translation notes, in a TSV file with the fields `template_name` and `template`\n", | |
"- an OpenAI API key" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"!pip install dspy scikit-learn rich -qq" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import os\n", | |
"import getpass\n", | |
"\n", | |
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"Enter your OpenAI API key: \")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"class BibleReader:\n", | |
" def __init__(self, file_path: str = 'bsb-utf8.csv'):\n", | |
" self.verses = {}\n", | |
" self._load_verses(file_path)\n", | |
"\n", | |
" def _load_verses(self, file_path: str) -> None:\n", | |
" try:\n", | |
" with open(file_path, 'r', encoding='utf-8') as file:\n", | |
" csv_reader = csv.reader(file, delimiter='\\t')\n", | |
" next(csv_reader) # Skip header\n", | |
" for row in csv_reader:\n", | |
" if len(row) == 2:\n", | |
" vref, content = row\n", | |
" self.verses[vref] = content\n", | |
" except FileNotFoundError:\n", | |
" print(f\"File not found: {file_path}\")\n", | |
" except Exception as e:\n", | |
" print(f\"An error occurred while loading verses: {e}\")\n", | |
"\n", | |
" def get_full_line(self, vref: str) -> str:\n", | |
" \"\"\"Get the full line (vref + content) for a given verse reference.\"\"\"\n", | |
" content = self.verses.get(vref)\n", | |
" return f\"{vref}\\t{content}\" if content else f\"Verse not found: {vref}\"\n", | |
"\n", | |
" def get_content(self, vref: str) -> str:\n", | |
" \"\"\"Get only the content for a given verse reference.\"\"\"\n", | |
" return self.verses.get(vref, f\"Verse not found: {vref}\")\n", | |
"\n", | |
" def get_vref(self, vref: str) -> str:\n", | |
" \"\"\"Get only the verse reference if it exists in the loaded verses.\"\"\"\n", | |
" return vref if vref in self.verses else f\"Verse not found: {vref}\"\n", | |
"\n", | |
" def generate_verses(self):\n", | |
" \"\"\"Generator function to yield all verses.\"\"\"\n", | |
" for vref, content in self.verses.items():\n", | |
" yield vref, content" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import dspy\n", | |
"from typing import List, Dict\n", | |
"from sklearn.feature_extraction.text import TfidfVectorizer\n", | |
"from sklearn.metrics.pairwise import cosine_similarity\n", | |
"import csv\n", | |
"import logging\n", | |
"\n", | |
"# Set up logging\n", | |
"logging.basicConfig(level=logging.INFO)\n", | |
"logger = logging.getLogger(__name__)\n", | |
"\n", | |
"# Define the signatures\n", | |
"class RetrieveContext(dspy.Signature):\n", | |
" \"\"\"Retrieve relevant paragraphs from the corpus.\"\"\"\n", | |
" context: str = dspy.InputField()\n", | |
" query: str = dspy.InputField()\n", | |
" relevant_paragraphs: List[str] = dspy.OutputField()\n", | |
"\n", | |
"class ClassifyFiguresOfSpeech(dspy.Signature):\n", | |
" \"\"\"Classify the input sentence for figures of speech.\"\"\"\n", | |
" sentence: str = dspy.InputField()\n", | |
" classifications: List[str] = dspy.OutputField()\n", | |
"\n", | |
"class SynthesizeNote(dspy.Signature):\n", | |
" \"\"\"Synthesize a new note with commentary on the classification.\"\"\"\n", | |
" sentence: str = dspy.InputField()\n", | |
" classifications: List[str] = dspy.InputField()\n", | |
" note: str = dspy.OutputField()\n", | |
"\n", | |
"# Set up the OpenAI GPT-4 model\n", | |
"gpt4_mini = dspy.OpenAI(model=\"gpt-4o-mini\")\n", | |
"dspy.settings.configure(lm=gpt4_mini)\n", | |
"\n", | |
"# Implement the modules\n", | |
"class RAG(dspy.Module):\n", | |
" def __init__(self, corpus_path):\n", | |
" super().__init__()\n", | |
" self.corpus = self.load_corpus(corpus_path)\n", | |
" if not self.corpus:\n", | |
" logger.warning(\"Corpus is empty. RAG functionality will be limited.\")\n", | |
" return\n", | |
" self.vectorizer = TfidfVectorizer(stop_words='english')\n", | |
" try:\n", | |
" self.tfidf_matrix = self.vectorizer.fit_transform(self.corpus)\n", | |
" except ValueError as e:\n", | |
" logger.error(f\"Error creating TF-IDF matrix: {e}\")\n", | |
" self.tfidf_matrix = None\n", | |
"\n", | |
" def load_corpus(self, corpus_path):\n", | |
" corpus = []\n", | |
" try:\n", | |
" for filename in os.listdir(corpus_path):\n", | |
" if filename.endswith('.tsv'):\n", | |
" with open(os.path.join(corpus_path, filename), 'r', newline='', encoding='utf-8') as f:\n", | |
" tsv_reader = csv.reader(f, delimiter='\\t')\n", | |
" next(tsv_reader) # Skip header row\n", | |
" for row in tsv_reader:\n", | |
" if len(row) >= 2: # Ensure there are at least two columns\n", | |
" corpus.append(row[1]) # Assuming content is in the second column\n", | |
" except Exception as e:\n", | |
" logger.error(f\"Error loading corpus: {e}\")\n", | |
" return corpus\n", | |
"\n", | |
" def forward(self, context, query):\n", | |
" if not self.corpus or self.tfidf_matrix is None:\n", | |
" logger.warning(\"RAG is not functional due to empty corpus or TF-IDF matrix.\")\n", | |
" return []\n", | |
" try:\n", | |
" query_vector = self.vectorizer.transform([query])\n", | |
" similarities = cosine_similarity(query_vector, self.tfidf_matrix).flatten()\n", | |
" top_indices = similarities.argsort()[-3:][::-1]\n", | |
" return [self.corpus[i] for i in top_indices]\n", | |
" except Exception as e:\n", | |
" logger.error(f\"Error in RAG forward pass: {e}\")\n", | |
" return []\n", | |
"\n", | |
"# read from /Users/ryderwishart/genesis/content_generation_pocs/templates.tsv, and get the 0th column\n", | |
"figures_of_speech_path = \"/Users/ryderwishart/genesis/content_generation_pocs/templates.tsv\"\n", | |
"with open(figures_of_speech_path, 'r') as file:\n", | |
" reader = csv.reader(file, delimiter='\\t')\n", | |
" next(reader) # Skip header row\n", | |
" figures_of_speech = [row[0] for row in reader]\n", | |
"\n", | |
"class FiguresOfSpeechClassifier(dspy.Module):\n", | |
" def __init__(self):\n", | |
" super().__init__()\n", | |
" self.figures_of_speech = figures_of_speech\n", | |
" self.classify = dspy.Predict(ClassifyFiguresOfSpeech)\n", | |
"\n", | |
" def forward(self, sentence):\n", | |
" prompt = f\"\"\"\n", | |
" Classify the following sentence for figures of speech. Choose from the list below:\n", | |
" {', '.join(self.figures_of_speech)}\n", | |
"\n", | |
" Sentence: \"{sentence}\"\n", | |
"\n", | |
" Provide up to 3 classifications, separated by commas.\n", | |
" \"\"\"\n", | |
" try:\n", | |
" result = self.classify(sentence=sentence)\n", | |
" return result.classifications\n", | |
" except Exception as e:\n", | |
" logger.error(f\"Error classifying figures of speech: {e}\")\n", | |
" return []\n", | |
"\n", | |
"class NoteSynthesizer(dspy.Module):\n", | |
" def __init__(self):\n", | |
" super().__init__()\n", | |
" self.synthesize = dspy.Predict(SynthesizeNote)\n", | |
"\n", | |
" def forward(self, sentence, classifications):\n", | |
" try:\n", | |
" result = self.synthesize(sentence=sentence, classifications=classifications)\n", | |
" return result.note\n", | |
" except Exception as e:\n", | |
" logger.error(f\"Error synthesizing note: {e}\")\n", | |
" return f\"Unable to synthesize note due to an error: {str(e)}\"\n", | |
"\n", | |
"# Main program\n", | |
"class FiguresOfSpeechAnalyzer(dspy.Module):\n", | |
" def __init__(self, corpus_path):\n", | |
" super().__init__()\n", | |
" self.rag = RAG(corpus_path)\n", | |
" self.classifier = FiguresOfSpeechClassifier()\n", | |
" self.synthesizer = NoteSynthesizer()\n", | |
"\n", | |
" def forward(self, sentence):\n", | |
" # Step 1: RAG\n", | |
" relevant_paragraphs = self.rag(context=\"\", query=sentence)\n", | |
"\n", | |
" # Step 2: Classification\n", | |
" classifications = self.classifier(sentence)\n", | |
"\n", | |
" # Step 3: Synthesis\n", | |
" note = self.synthesizer(sentence, classifications)\n", | |
"\n", | |
" return {\n", | |
" \"relevant_paragraphs\": relevant_paragraphs,\n", | |
" \"classifications\": classifications,\n", | |
" \"note\": note\n", | |
" }\n", | |
"\n", | |
"# Usage\n", | |
"corpus_path = \"/Users/ryderwishart/genesis/content_generation_pocs/en_tn\"\n", | |
"analyzer = FiguresOfSpeechAnalyzer(corpus_path)\n", | |
"\n", | |
"# Example usage\n", | |
"# input_sentence = \"The prophecy of Jonah, the son of Amittai, who was of the tribe of Gad\"\n", | |
"# result = analyzer(input_sentence)\n", | |
"\n", | |
"# print(\"Relevant paragraphs:\", result[\"relevant_paragraphs\"])\n", | |
"# print(\"Classifications:\", result[\"classifications\"])\n", | |
"# print(\"Note:\", result[\"note\"])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭───────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:1 ──────────────╮\n", | |
"│ <span style=\"font-style: italic\">In the beginning God created the heavens and the earth.</span> │\n", | |
"╰─────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭───────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:1 ──────────────╮\n", | |
"│ \u001b[3mIn the beginning God created the heavens and the earth.\u001b[0m │\n", | |
"╰─────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: In the beginning God created the heavens and the earth. │\n", | |
"│ Classifications: Allusion, Metaphor, Personification │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ Sentence: In the beginning God created the heavens and the earth. │\n", | |
"│ Classifications: Allusion, Metaphor, Personification │\n", | |
"│ Note: This sentence is a profound allusion to the biblical creation narrative found in Genesis, which serves as │\n", | |
"│ a foundational text in Judeo-Christian theology. The phrase \"In the beginning\" signifies the commencement of │\n", | |
"│ time and existence, while \"God created\" personifies a divine entity with the power to shape reality. The term │\n", | |
"│ \"heavens and the earth\" functions as a metaphor for the entirety of the universe, encapsulating both the │\n", | |
"│ celestial and terrestrial realms. This layered meaning invites reflection on themes of origin, divinity, and │\n", | |
"│ the nature of existence itself. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: In the beginning God created the heavens and the earth. │\n", | |
"│ Classifications: Allusion, Metaphor, Personification │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ Sentence: In the beginning God created the heavens and the earth. │\n", | |
"│ Classifications: Allusion, Metaphor, Personification │\n", | |
"│ Note: This sentence is a profound allusion to the biblical creation narrative found in Genesis, which serves as │\n", | |
"│ a foundational text in Judeo-Christian theology. The phrase \"In the beginning\" signifies the commencement of │\n", | |
"│ time and existence, while \"God created\" personifies a divine entity with the power to shape reality. The term │\n", | |
"│ \"heavens and the earth\" functions as a metaphor for the entirety of the universe, encapsulating both the │\n", | |
"│ celestial and terrestrial realms. This layered meaning invites reflection on themes of origin, divinity, and │\n", | |
"│ the nature of existence itself. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭───────────────────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:2 ──────────────────────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was </span> │\n", | |
"│ <span style=\"font-style: italic\">hovering over the surface of the waters.</span> │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭───────────────────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:2 ──────────────────────────────────────────╮\n", | |
"│ \u001b[3mNow the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was \u001b[0m │\n", | |
"│ \u001b[3mhovering over the surface of the waters.\u001b[0m │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of │\n", | |
"│ God was hovering over the surface of the waters. │\n", | |
"│ Classifications: Imagery, Personification, Alliteration, Metaphor │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ The sentence employs vivid imagery to evoke a sense of emptiness and chaos at the beginning of creation. The │\n", | |
"│ phrase \"formless and void\" creates a stark visual of desolation, while \"darkness was over the surface of the │\n", | |
"│ deep\" enhances this imagery by suggesting an overwhelming absence of light and life. The personification of the │\n", | |
"│ \"Spirit of God\" as hovering introduces a sense of divine presence and anticipation, implying that │\n", | |
"│ transformation is imminent. Additionally, the alliteration in \"surface of the waters\" adds a rhythmic quality │\n", | |
"│ to the sentence, drawing attention to the setting. The metaphorical language encapsulates the profound │\n", | |
"│ transition from chaos to order, setting the stage for the unfolding of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of │\n", | |
"│ God was hovering over the surface of the waters. │\n", | |
"│ Classifications: Imagery, Personification, Alliteration, Metaphor │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ The sentence employs vivid imagery to evoke a sense of emptiness and chaos at the beginning of creation. The │\n", | |
"│ phrase \"formless and void\" creates a stark visual of desolation, while \"darkness was over the surface of the │\n", | |
"│ deep\" enhances this imagery by suggesting an overwhelming absence of light and life. The personification of the │\n", | |
"│ \"Spirit of God\" as hovering introduces a sense of divine presence and anticipation, implying that │\n", | |
"│ transformation is imminent. Additionally, the alliteration in \"surface of the waters\" adds a rhythmic quality │\n", | |
"│ to the sentence, drawing attention to the setting. The metaphorical language encapsulates the profound │\n", | |
"│ transition from chaos to order, setting the stage for the unfolding of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:3 ──────────────╮\n", | |
"│ <span style=\"font-style: italic\">And God said, \"Let there be light,\" and there was light.</span> │\n", | |
"╰──────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:3 ──────────────╮\n", | |
"│ \u001b[3mAnd God said, \"Let there be light,\" and there was light.\u001b[0m │\n", | |
"╰──────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: And God said, \"Let there be light,\" and there was light. │\n", | |
"│ Classifications: Allusion, Personification, Hyperbole │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ Sentence: And God said, \"Let there be light,\" and there was light. │\n", | |
"│ Classifications: Allusion, Personification, Hyperbole │\n", | |
"│ Note: This sentence is a direct allusion to the biblical creation narrative found in Genesis, where God's │\n", | |
"│ command brings forth light, symbolizing the introduction of order and clarity into chaos. The use of │\n", | |
"│ personification is evident as God is depicted as a speaking entity capable of creating through words, │\n", | |
"│ emphasizing the power of divine speech. Additionally, the phrase can be seen as hyperbolic, as it suggests an │\n", | |
"│ instantaneous transformation of darkness into light, highlighting the dramatic nature of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: And God said, \"Let there be light,\" and there was light. │\n", | |
"│ Classifications: Allusion, Personification, Hyperbole │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ Sentence: And God said, \"Let there be light,\" and there was light. │\n", | |
"│ Classifications: Allusion, Personification, Hyperbole │\n", | |
"│ Note: This sentence is a direct allusion to the biblical creation narrative found in Genesis, where God's │\n", | |
"│ command brings forth light, symbolizing the introduction of order and clarity into chaos. The use of │\n", | |
"│ personification is evident as God is depicted as a speaking entity capable of creating through words, │\n", | |
"│ emphasizing the power of divine speech. Additionally, the phrase can be seen as hyperbolic, as it suggests an │\n", | |
"│ instantaneous transformation of darkness into light, highlighting the dramatic nature of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:4 ───────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">And God saw that the light was good, and He separated the light from the darkness.</span> │\n", | |
"╰────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:4 ───────────────────────────╮\n", | |
"│ \u001b[3mAnd God saw that the light was good, and He separated the light from the darkness.\u001b[0m │\n", | |
"╰────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: And God saw that the light was good, and He separated the light from the darkness. │\n", | |
"│ Classifications: Personification, Contrast, Imagery │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ Sentence: And God saw that the light was good, and He separated the light from the darkness. │\n", | |
"│ Classifications: Personification, Contrast, Imagery │\n", | |
"│ Note: This sentence employs personification by attributing human-like qualities to God, who observes and │\n", | |
"│ evaluates the light. The contrast between light and darkness serves to highlight the theme of good versus evil, │\n", | |
"│ while the imagery evokes a vivid mental picture of creation, emphasizing the significance of light in the │\n", | |
"│ narrative. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: And God saw that the light was good, and He separated the light from the darkness. │\n", | |
"│ Classifications: Personification, Contrast, Imagery │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ Sentence: And God saw that the light was good, and He separated the light from the darkness. │\n", | |
"│ Classifications: Personification, Contrast, Imagery │\n", | |
"│ Note: This sentence employs personification by attributing human-like qualities to God, who observes and │\n", | |
"│ evaluates the light. The contrast between light and darkness serves to highlight the theme of good versus evil, │\n", | |
"│ while the imagery evokes a vivid mental picture of creation, emphasizing the significance of light in the │\n", | |
"│ narrative. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭───────────────────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:5 ──────────────────────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">God called the light \"day,\" and the darkness He called \"night.\" And there was evening, and there was </span> │\n", | |
"│ <span style=\"font-style: italic\">morning—the first day.</span> │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭───────────────────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:5 ──────────────────────────────────────────╮\n", | |
"│ \u001b[3mGod called the light \"day,\" and the darkness He called \"night.\" And there was evening, and there was \u001b[0m │\n", | |
"│ \u001b[3mmorning—the first day.\u001b[0m │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: God called the light \"day,\" and the darkness He called \"night.\" And there was evening, and there was │\n", | |
"│ morning—the first day. │\n", | |
"│ Classifications: Metaphor, Personification, Alliteration │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ The sentence employs metaphorical language by attributing human-like qualities to God, who \"calls\" the light │\n", | |
"│ and darkness by names, suggesting a creative authority over the natural world. The personification of light and │\n", | |
"│ darkness as entities that can be named enhances the imagery of creation. Additionally, the repetition of sounds │\n", | |
"│ in \"evening\" and \"morning\" introduces an element of alliteration, which adds a lyrical quality to the text, │\n", | |
"│ emphasizing the cyclical nature of time and the rhythm of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: God called the light \"day,\" and the darkness He called \"night.\" And there was evening, and there was │\n", | |
"│ morning—the first day. │\n", | |
"│ Classifications: Metaphor, Personification, Alliteration │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ The sentence employs metaphorical language by attributing human-like qualities to God, who \"calls\" the light │\n", | |
"│ and darkness by names, suggesting a creative authority over the natural world. The personification of light and │\n", | |
"│ darkness as entities that can be named enhances the imagery of creation. Additionally, the repetition of sounds │\n", | |
"│ in \"evening\" and \"morning\" introduces an element of alliteration, which adds a lyrical quality to the text, │\n", | |
"│ emphasizing the cyclical nature of time and the rhythm of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:6 ────────────────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">And God said, “Let there be an expanse between the waters, to separate the waters from the waters.”</span> │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:6 ────────────────────────────────────╮\n", | |
"│ \u001b[3mAnd God said, “Let there be an expanse between the waters, to separate the waters from the waters.”\u001b[0m │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: And God said, “Let there be an expanse between the waters, to separate the waters from the waters.” │\n", | |
"│ Classifications: Alliteration, Imagery, Personification, Metaphor │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ Sentence: And God said, “Let there be an expanse between the waters, to separate the waters from the waters.” │\n", | |
"│ Classifications: Alliteration, Imagery, Personification, Metaphor │\n", | |
"│ Note: This sentence employs alliteration with the repetition of the 'w' sound, enhancing its poetic quality. │\n", | |
"│ The imagery is vivid, as it evokes a visual separation of waters, creating a mental picture of the creation │\n", | |
"│ process. Personification is present in the phrase \"And God said,\" attributing human-like qualities to the │\n", | |
"│ divine, suggesting an active role in creation. The metaphor of \"expanse\" symbolizes the sky or atmosphere, │\n", | |
"│ representing a boundary that distinguishes different realms of existence. Overall, the sentence encapsulates │\n", | |
"│ themes of order and separation in │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: And God said, “Let there be an expanse between the waters, to separate the waters from the waters.” │\n", | |
"│ Classifications: Alliteration, Imagery, Personification, Metaphor │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ Sentence: And God said, “Let there be an expanse between the waters, to separate the waters from the waters.” │\n", | |
"│ Classifications: Alliteration, Imagery, Personification, Metaphor │\n", | |
"│ Note: This sentence employs alliteration with the repetition of the 'w' sound, enhancing its poetic quality. │\n", | |
"│ The imagery is vivid, as it evokes a visual separation of waters, creating a mental picture of the creation │\n", | |
"│ process. Personification is present in the phrase \"And God said,\" attributing human-like qualities to the │\n", | |
"│ divine, suggesting an active role in creation. The metaphor of \"expanse\" symbolizes the sky or atmosphere, │\n", | |
"│ representing a boundary that distinguishes different realms of existence. Overall, the sentence encapsulates │\n", | |
"│ themes of order and separation in │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭────────────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:7 ───────────────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">So God made the expanse and separated the waters beneath it from the waters above. And it was so.</span> │\n", | |
"╰───────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭────────────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:7 ───────────────────────────────────╮\n", | |
"│ \u001b[3mSo God made the expanse and separated the waters beneath it from the waters above. And it was so.\u001b[0m │\n", | |
"╰───────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: So God made the expanse and separated the waters beneath it from the waters above. And it was so. │\n", | |
"│ Classifications: Imagery, Personification, Alliteration │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ Sentence: So God made the expanse and separated the waters beneath it from the waters above. And it was so. │\n", | |
"│ Classifications: Imagery, Personification, Alliteration │\n", | |
"│ Note: This sentence employs vivid imagery to evoke a visual representation of creation, illustrating the │\n", | |
"│ separation of waters in a cosmic setting. The use of personification attributes human-like qualities to God, │\n", | |
"│ emphasizing His active role in the creation process. Additionally, the repetition of the 'w' sound in \"waters\" │\n", | |
"│ and \"was\" creates alliteration, enhancing the lyrical quality of the text and reinforcing its rhythmic flow. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: So God made the expanse and separated the waters beneath it from the waters above. And it was so. │\n", | |
"│ Classifications: Imagery, Personification, Alliteration │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ Sentence: So God made the expanse and separated the waters beneath it from the waters above. And it was so. │\n", | |
"│ Classifications: Imagery, Personification, Alliteration │\n", | |
"│ Note: This sentence employs vivid imagery to evoke a visual representation of creation, illustrating the │\n", | |
"│ separation of waters in a cosmic setting. The use of personification attributes human-like qualities to God, │\n", | |
"│ emphasizing His active role in the creation process. Additionally, the repetition of the 'w' sound in \"waters\" │\n", | |
"│ and \"was\" creates alliteration, enhancing the lyrical quality of the text and reinforcing its rhythmic flow. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:8 ───────────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">God called the expanse “sky.” And there was evening, and there was morning—the second day.</span> │\n", | |
"╰────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:8 ───────────────────────────────╮\n", | |
"│ \u001b[3mGod called the expanse “sky.” And there was evening, and there was morning—the second day.\u001b[0m │\n", | |
"╰────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: God called the expanse “sky.” And there was evening, and there was morning—the second day. │\n", | |
"│ Classifications: Metaphor, Personification, Imagery, Alliteration │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ Sentence: God called the expanse “sky.” And there was evening, and there was morning—the second day. │\n", | |
"│ Classifications: Metaphor, Personification, Imagery, Alliteration │\n", | |
"│ Note: This sentence employs metaphor by referring to the expanse as \"sky,\" which conveys a deeper meaning about │\n", | |
"│ the creation of the heavens. The personification of God gives a divine character to the act of naming, │\n", | |
"│ suggesting authority and intentionality in creation. Imagery is present as it evokes a visual representation of │\n", | |
"│ the sky and the transition from evening to morning, enhancing the reader's sensory experience. Additionally, │\n", | |
"│ the repetition of sounds in \"evening\" and \"morning\" creates a subtle alliteration that adds a lyrical quality │\n", | |
"│ to the text, emphasizing │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: God called the expanse “sky.” And there was evening, and there was morning—the second day. │\n", | |
"│ Classifications: Metaphor, Personification, Imagery, Alliteration │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ Sentence: God called the expanse “sky.” And there was evening, and there was morning—the second day. │\n", | |
"│ Classifications: Metaphor, Personification, Imagery, Alliteration │\n", | |
"│ Note: This sentence employs metaphor by referring to the expanse as \"sky,\" which conveys a deeper meaning about │\n", | |
"│ the creation of the heavens. The personification of God gives a divine character to the act of naming, │\n", | |
"│ suggesting authority and intentionality in creation. Imagery is present as it evokes a visual representation of │\n", | |
"│ the sky and the transition from evening to morning, enhancing the reader's sensory experience. Additionally, │\n", | |
"│ the repetition of sounds in \"evening\" and \"morning\" creates a subtle alliteration that adds a lyrical quality │\n", | |
"│ to the text, emphasizing │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭───────────────────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:9 ──────────────────────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">And God said, “Let the waters under the sky be gathered into one place, so that the dry land may appear.” And </span> │\n", | |
"│ <span style=\"font-style: italic\">it was so.</span> │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭───────────────────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:9 ──────────────────────────────────────────╮\n", | |
"│ \u001b[3mAnd God said, “Let the waters under the sky be gathered into one place, so that the dry land may appear.” And \u001b[0m │\n", | |
"│ \u001b[3mit was so.\u001b[0m │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: And God said, “Let the waters under the sky be gathered into one place, so that the dry land may │\n", | |
"│ appear.” And it was so. │\n", | |
"│ Classifications: Personification, Allusion, Imperative Sentence, Hyperbole │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ This sentence exemplifies the use of personification as it attributes human-like qualities to God, who commands │\n", | |
"│ the natural elements. The phrase \"Let the waters under the sky be gathered\" reflects an authoritative tone, │\n", | |
"│ characteristic of an imperative sentence, indicating a direct command. Additionally, the reference to God and │\n", | |
"│ the act of creation alludes to biblical narratives, particularly the Genesis account of creation. The statement │\n", | |
"│ can also be seen as hyperbolic, as it simplifies the complex processes of nature into a single divine command, │\n", | |
"│ emphasizing the power and sovereignty of God in the act of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: And God said, “Let the waters under the sky be gathered into one place, so that the dry land may │\n", | |
"│ appear.” And it was so. │\n", | |
"│ Classifications: Personification, Allusion, Imperative Sentence, Hyperbole │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ This sentence exemplifies the use of personification as it attributes human-like qualities to God, who commands │\n", | |
"│ the natural elements. The phrase \"Let the waters under the sky be gathered\" reflects an authoritative tone, │\n", | |
"│ characteristic of an imperative sentence, indicating a direct command. Additionally, the reference to God and │\n", | |
"│ the act of creation alludes to biblical narratives, particularly the Genesis account of creation. The statement │\n", | |
"│ can also be seen as hyperbolic, as it simplifies the complex processes of nature into a single divine command, │\n", | |
"│ emphasizing the power and sovereignty of God in the act of creation. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────── <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">Verse Reference:</span> Genesis 1:10 ────────────────────────────────────────╮\n", | |
"│ <span style=\"font-style: italic\">God called the dry land “earth,” and the gathering of waters He called “seas.” And God saw that it was good.</span> │\n", | |
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────── \u001b[1;34mVerse Reference:\u001b[0m Genesis 1:10 ────────────────────────────────────────╮\n", | |
"│ \u001b[3mGod called the dry land “earth,” and the gathering of waters He called “seas.” And God saw that it was good.\u001b[0m │\n", | |
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">Relevant Paragraphs:</span> │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">Classifications:</span> │\n", | |
"│ Sentence: God called the dry land “earth,” and the gathering of waters He called “seas.” And God saw that it │\n", | |
"│ was good. │\n", | |
"│ Classifications: Metaphor, Personification, Alliteration │\n", | |
"│ │\n", | |
"│ <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Note:</span> │\n", | |
"│ Sentence: God called the dry land “earth,” and the gathering of waters He called “seas.” And God saw that it │\n", | |
"│ was good. │\n", | |
"│ Classifications: Metaphor, Personification, Alliteration │\n", | |
"│ Note: This sentence employs metaphor by attributing human-like qualities to God, who names the elements of │\n", | |
"│ creation, thus personifying the divine act of creation. The use of alliteration in \"gathering of waters\" │\n", | |
"│ enhances the lyrical quality of the text, making it more memorable and impactful. The overall message conveys a │\n", | |
"│ sense of order and goodness in creation, reflecting a harmonious relationship between the elements of nature. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"╭─────────────────────────────────────────────────── Analysis ────────────────────────────────────────────────────╮\n", | |
"│ \u001b[1;32mRelevant Paragraphs:\u001b[0m │\n", | |
"│ ['14', '3', '3'] │\n", | |
"│ │\n", | |
"│ \u001b[1;33mClassifications:\u001b[0m │\n", | |
"│ Sentence: God called the dry land “earth,” and the gathering of waters He called “seas.” And God saw that it │\n", | |
"│ was good. │\n", | |
"│ Classifications: Metaphor, Personification, Alliteration │\n", | |
"│ │\n", | |
"│ \u001b[1;35mNote:\u001b[0m │\n", | |
"│ Sentence: God called the dry land “earth,” and the gathering of waters He called “seas.” And God saw that it │\n", | |
"│ was good. │\n", | |
"│ Classifications: Metaphor, Personification, Alliteration │\n", | |
"│ Note: This sentence employs metaphor by attributing human-like qualities to God, who names the elements of │\n", | |
"│ creation, thus personifying the divine act of creation. The use of alliteration in \"gathering of waters\" │\n", | |
"│ enhances the lyrical quality of the text, making it more memorable and impactful. The overall message conveys a │\n", | |
"│ sense of order and goodness in creation, reflecting a harmonious relationship between the elements of nature. │\n", | |
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n", | |
"\n", | |
"</pre>\n" | |
], | |
"text/plain": [ | |
"\n", | |
"\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"from rich.console import Console\n", | |
"from rich.panel import Panel\n", | |
"from rich.text import Text\n", | |
"\n", | |
"console = Console()\n", | |
"bible = BibleReader()\n", | |
"\n", | |
"for i, (vref, content) in enumerate(bible.generate_verses()):\n", | |
" if i >= 10:\n", | |
" break\n", | |
" result = analyzer(content)\n", | |
" \n", | |
" verse_panel = Panel(\n", | |
" Text(content, style=\"italic\"),\n", | |
" title=f\"[bold blue]Verse Reference:[/bold blue] {vref}\",\n", | |
" expand=False\n", | |
" )\n", | |
" \n", | |
" analysis_panel = Panel(\n", | |
" f\"[bold green]Relevant Paragraphs:[/bold green]\\n{result['relevant_paragraphs']}\\n\\n\"\n", | |
" f\"[bold yellow]Classifications:[/bold yellow]\\n{result['classifications']}\\n\\n\"\n", | |
" f\"[bold magenta]Note:[/bold magenta]\\n{result['note']}\",\n", | |
" title=\"Analysis\",\n", | |
" expand=False\n", | |
" )\n", | |
" \n", | |
" console.print(verse_panel)\n", | |
" console.print(analysis_panel)\n", | |
" console.print(\"\\n\")" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "venv", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.12.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment