From 7826e28a28b68e065207c5e52105adc44e784c5b Mon Sep 17 00:00:00 2001 From: Andrew Ellis Date: Thu, 28 Nov 2024 09:20:33 +0100 Subject: [PATCH] rebuild --- .../example/index/execute-results/html.json | 12 + docs/projects/anki/example/index.html | 1130 +++++++++++++++++ docs/projects/anki/index.html | 250 ++-- docs/sitemap.xml | 6 +- 4 files changed, 1280 insertions(+), 118 deletions(-) create mode 100644 _freeze/projects/anki/example/index/execute-results/html.json create mode 100644 docs/projects/anki/example/index.html diff --git a/_freeze/projects/anki/example/index/execute-results/html.json b/_freeze/projects/anki/example/index/execute-results/html.json new file mode 100644 index 0000000..2d6c457 --- /dev/null +++ b/_freeze/projects/anki/example/index/execute-results/html.json @@ -0,0 +1,12 @@ +{ + "hash": "693eaafcd014332b4b1220990dbe7fe8", + "result": { + "engine": "jupyter", + "markdown": "---\ntitle: \"Generate Anki flashcards: example code\"\njupyter: python3\nexecute: \n cache: true\n---\n\n::: {#de27807c .cell execution_count=1}\n``` {.python .cell-code}\nimport os\nimport csv\nfrom dotenv import load_dotenv # For loading environment variables\nfrom openai import OpenAI \n\nfrom pydantic import BaseModel, Field\nfrom typing import List\n```\n:::\n\n\n::: {#2c201188 .cell execution_count=2}\n``` {.python .cell-code}\nload_dotenv()\nclient = OpenAI()\n```\n:::\n\n\n::: {#38f58126 .cell execution_count=3}\n``` {.python .cell-code}\nclass AnkiFlashcard(BaseModel):\n \"\"\"\n Model representing a single Anki flashcard with question, answer, and tags.\n \"\"\"\n # Define required fields with descriptions\n question: str = Field(..., description=\"The front side of the flashcard containing the question\")\n answer: str = Field(..., description=\"The back side of the flashcard containing the answer\")\n tags: List[str] = Field(..., description=\"List of tags associated with the flashcard\")\n```\n:::\n\n\n::: {#571a9bda .cell execution_count=4}\n``` {.python .cell-code}\nclass AnkiDeck(BaseModel):\n \"\"\"\n Model representing a complete Anki deck containing multiple flashcards.\n \"\"\"\n # Define required fields with descriptions\n cards: List[AnkiFlashcard] = Field(..., description=\"List of flashcards in the deck\")\n deck_name: str = Field(..., description=\"Name of the Anki deck\")\n```\n:::\n\n\n::: {#93d3c3f9 .cell execution_count=5}\n``` {.python .cell-code}\ndef generate_structured_flashcards(text: str, \n deck_name: str, \n num_cards: int = 5) -> AnkiDeck:\n \"\"\"\n Generate structured flashcards using GPT-4o with enforced Pydantic model output.\n \n Args:\n text (str): The input text to generate flashcards from\n deck_name (str): Name for the Anki deck\n num_cards (int): Number of flashcards to generate (default: 5)\n \n Returns:\n AnkiDeck: A structured deck of flashcards with proper validation\n \n Raises:\n ValueError: If num_cards is less than 1\n \"\"\"\n # Validate input\n if num_cards < 1:\n raise ValueError(\"Number of cards must be at least 1\")\n \n # Make API call with structured output format\n completion = client.beta.chat.completions.parse(\n model=\"gpt-4o\",\n messages=[\n {\n \"role\": \"system\",\n \"content\": f\"\"\"You are an expert at creating Anki flashcards. Your task is to:\n1. Read the provided text\n2. Create {num_cards} Anki flashcards that cover the main concepts\n3. Add relevant tags to each flashcard\n4. Structure the output as an Anki deck with the name \"{deck_name}\".\"\"\"\n },\n {\n \"role\": \"user\",\n \"content\": f\"Please create Anki flashcards for the following text: {text}\"\n }\n ],\n response_format=AnkiDeck,\n )\n \n # Return the parsed response\n return completion.choices[0].message.parsed\n```\n:::\n\n\n\n\n:::{.callout-note collapse=true title=\"`romantic_text`\"}\n## The Romantic Era: Emotion Unleashed (1810-1910)\n\nThe Romantic era represented a dramatic shift in musical aesthetics, prioritizing emotional expression, individualism, and nationalism over the formal constraints of the Classical period. This century-long period saw an unprecedented expansion in the scope, scale, and emotional range of classical music.\n\n### The Romantic Spirit\n\nRomanticism emerged as a reaction against the rationalism of the Enlightenment and the Industrial Revolution. Composers sought to express intense personal emotions, explore supernatural themes, and celebrate national identity through music. This new aesthetic led to the development of program music - compositions that told specific stories or painted musical pictures.\n\n### Expansion of Musical Language\n\nThe Romantic period saw a significant expansion of harmonic language. Composers pushed the boundaries of chromatic harmony, using increasingly complex chord progressions and modulations to distant keys. This development reached its apex in Wagner's \"Tristan und Isolde,\" whose famous \"Tristan chord\" symbolized the dissolution of traditional tonality.\n\n### The Symphony Transformed\n\nThe symphony, inherited from the Classical era, underwent radical transformation. Beethoven's Ninth Symphony, with its unprecedented scale and inclusion of vocal soloists and chorus, set new standards for symphonic composition. Later composers like Berlioz, Mahler, and Bruckner created symphonies of enormous proportions, both in length and orchestral forces.\n\n### New Forms and Genres\n\nThe period saw the emergence of new musical forms suited to Romantic expression. The symphonic poem, developed by Franz Liszt, combined orchestral music with extra-musical narratives. The art song (Lied) reached new heights of sophistication in the hands of Schubert and Schumann, creating perfect unions of poetry and music.\n\n### Nationalism in Music\n\nNational schools of composition emerged as countries sought to express their cultural identity through music. Russian composers like Tchaikovsky and the \"Mighty Five\" incorporated folk melodies and national themes. Similar movements appeared in Bohemia (Smetana, Dvoล™รกk), Norway (Grieg), and other European nations.\n\n### The Rise of the Virtuoso\n\nThe Romantic era celebrated individual achievement, leading to the rise of the virtuoso performer. Pianists like Liszt and Chopin composed works of unprecedented technical difficulty, while violinists like Paganini pushed the boundaries of what was possible on their instrument. This emphasis on virtuosity influenced compositional style and public performance practices.\n\n### Wagner and Music Drama\n\nRichard Wagner revolutionized opera through his concept of Gesamtkunstwerk (total artwork), combining music, drama, poetry, and visual arts. His use of leitmotifs - recurring musical themes associated with characters, objects, or ideas - influenced not only opera but also symphonic composition and, later, film music.\n\n### Technical and Social Developments\n\nThe period saw significant developments in instrument construction. The modern piano reached its current form, while brass instruments benefited from the invention of valves. Orchestras grew larger, requiring the emergence of the conductor as an interpreter rather than merely a timekeeper.\n\n### The End of an Era\n\nThe Romantic period gradually gave way to various modern movements. The increasing chromatic harmony of late Romanticism led naturally to the breakdown of traditional tonality in the early 20th century. However, Romantic ideals of emotional expression and individualism continued to influence composers well into the modern era.\n\nThe Romantic era's emphasis on emotional expression, its technical innovations, and its expansion of musical possibilities created a legacy that continues to influence musicians today. The period's great works remain central to the concert repertoire, beloved for their emotional depth and expressive power.\n:::\n\n\n\n::: {#b6f029bd .cell execution_count=8}\n``` {.python .cell-code}\nromantic_deck = generate_structured_flashcards(romantic_text,\n \"Romanticism\", \n num_cards=10)\n```\n:::\n\n\n::: {#a6ec19d9 .cell execution_count=9}\n``` {.python .cell-code}\nromantic_deck\n```\n\n::: {.cell-output .cell-output-display execution_count=52}\n```\nAnkiDeck(cards=[AnkiFlashcard(question='What major shift did the Romantic era represent in musical aesthetics?', answer='The Romantic era represented a shift towards prioritizing emotional expression, individualism, and nationalism, moving away from the formal constraints of the Classical period.', tags=['Romanticism', 'MusicAesthetics']), AnkiFlashcard(question='What is program music and how did it relate to Romanticism?', answer=\"Program music is a type of composition that tells specific stories or paints musical pictures, aligned with Romanticism's emphasis on emotional expression and supernatural themes.\", tags=['Romanticism', 'ProgramMusic']), AnkiFlashcard(question='How did harmonic language expand during the Romantic period?', answer='Composers expanded harmonic language by pushing boundaries of chromatic harmony, using complex chord progressions and modulations, exemplified by Wagner\\'s \"Tristan chord.\"', tags=['Romanticism', 'HarmonicLanguage']), AnkiFlashcard(question='Which symphony transformed the symphonic form during the Romantic era?', answer=\"Beethoven's Ninth Symphony transformed the symphonic form with its unprecedented scale and inclusion of vocal soloists and chorus.\", tags=['Romanticism', 'Symphony']), AnkiFlashcard(question='What is a symphonic poem and who developed it?', answer='A symphonic poem is an orchestral work that combines music with extra-musical narratives, developed by Franz Liszt.', tags=['Romanticism', 'MusicalForms']), AnkiFlashcard(question='Which regions developed national schools of composition during the Romantic era?', answer='National schools of composition emerged in Russia, Bohemia, Norway, and other European nations, often incorporating folk melodies and national themes.', tags=['Romanticism', 'Nationalism']), AnkiFlashcard(question='Who were some notable virtuoso performers during the Romantic era?', answer='Notable virtuoso performers included pianists like Liszt and Chopin, and violinists like Paganini, known for their technical achievements.', tags=['Romanticism', 'Virtuosos']), AnkiFlashcard(question='What concept did Wagner introduce in opera, and how did it influence other genres?', answer='Wagner introduced the concept of Gesamtkunstwerk (total artwork) and leitmotifs, influencing opera, symphonic composition, and film music.', tags=['Romanticism', 'Opera']), AnkiFlashcard(question='How did instrument construction and orchestra management change during the Romantic period?', answer='Instruments like the piano and brass instruments evolved; orchestras grew larger, making conductors interpreters rather than merely timekeepers.', tags=['Romanticism', 'Instrumentation']), AnkiFlashcard(question='How did the Romantic era influence later musical movements?', answer='The breakdown of traditional tonality led to modern movements, but Romantic ideals of emotional expression and individualism continued influencing composers.', tags=['Romanticism', 'ModernInfluence'])], deck_name='Romanticism')\n```\n:::\n:::\n\n\n::: {#ae689ec1 .cell execution_count=10}\n``` {.python .cell-code}\nprint(romantic_deck.model_dump_json())\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n{\"cards\":[{\"question\":\"What major shift did the Romantic era represent in musical aesthetics?\",\"answer\":\"The Romantic era represented a shift towards prioritizing emotional expression, individualism, and nationalism, moving away from the formal constraints of the Classical period.\",\"tags\":[\"Romanticism\",\"MusicAesthetics\"]},{\"question\":\"What is program music and how did it relate to Romanticism?\",\"answer\":\"Program music is a type of composition that tells specific stories or paints musical pictures, aligned with Romanticism's emphasis on emotional expression and supernatural themes.\",\"tags\":[\"Romanticism\",\"ProgramMusic\"]},{\"question\":\"How did harmonic language expand during the Romantic period?\",\"answer\":\"Composers expanded harmonic language by pushing boundaries of chromatic harmony, using complex chord progressions and modulations, exemplified by Wagner's \\\"Tristan chord.\\\"\",\"tags\":[\"Romanticism\",\"HarmonicLanguage\"]},{\"question\":\"Which symphony transformed the symphonic form during the Romantic era?\",\"answer\":\"Beethoven's Ninth Symphony transformed the symphonic form with its unprecedented scale and inclusion of vocal soloists and chorus.\",\"tags\":[\"Romanticism\",\"Symphony\"]},{\"question\":\"What is a symphonic poem and who developed it?\",\"answer\":\"A symphonic poem is an orchestral work that combines music with extra-musical narratives, developed by Franz Liszt.\",\"tags\":[\"Romanticism\",\"MusicalForms\"]},{\"question\":\"Which regions developed national schools of composition during the Romantic era?\",\"answer\":\"National schools of composition emerged in Russia, Bohemia, Norway, and other European nations, often incorporating folk melodies and national themes.\",\"tags\":[\"Romanticism\",\"Nationalism\"]},{\"question\":\"Who were some notable virtuoso performers during the Romantic era?\",\"answer\":\"Notable virtuoso performers included pianists like Liszt and Chopin, and violinists like Paganini, known for their technical achievements.\",\"tags\":[\"Romanticism\",\"Virtuosos\"]},{\"question\":\"What concept did Wagner introduce in opera, and how did it influence other genres?\",\"answer\":\"Wagner introduced the concept of Gesamtkunstwerk (total artwork) and leitmotifs, influencing opera, symphonic composition, and film music.\",\"tags\":[\"Romanticism\",\"Opera\"]},{\"question\":\"How did instrument construction and orchestra management change during the Romantic period?\",\"answer\":\"Instruments like the piano and brass instruments evolved; orchestras grew larger, making conductors interpreters rather than merely timekeepers.\",\"tags\":[\"Romanticism\",\"Instrumentation\"]},{\"question\":\"How did the Romantic era influence later musical movements?\",\"answer\":\"The breakdown of traditional tonality led to modern movements, but Romantic ideals of emotional expression and individualism continued influencing composers.\",\"tags\":[\"Romanticism\",\"ModernInfluence\"]}],\"deck_name\":\"Romanticism\"}\n```\n:::\n:::\n\n\n::: {#0098c8a5 .cell execution_count=11}\n``` {.python .cell-code}\nfor card in romantic_deck.cards:\n print(f\"Question: {card.question}\")\n print(f\"Answer: {card.answer}\")\n print(f\"Tags: {', '.join(card.tags)}\")\n print(\"-\" * 20)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nQuestion: What major shift did the Romantic era represent in musical aesthetics?\nAnswer: The Romantic era represented a shift towards prioritizing emotional expression, individualism, and nationalism, moving away from the formal constraints of the Classical period.\nTags: Romanticism, MusicAesthetics\n--------------------\nQuestion: What is program music and how did it relate to Romanticism?\nAnswer: Program music is a type of composition that tells specific stories or paints musical pictures, aligned with Romanticism's emphasis on emotional expression and supernatural themes.\nTags: Romanticism, ProgramMusic\n--------------------\nQuestion: How did harmonic language expand during the Romantic period?\nAnswer: Composers expanded harmonic language by pushing boundaries of chromatic harmony, using complex chord progressions and modulations, exemplified by Wagner's \"Tristan chord.\"\nTags: Romanticism, HarmonicLanguage\n--------------------\nQuestion: Which symphony transformed the symphonic form during the Romantic era?\nAnswer: Beethoven's Ninth Symphony transformed the symphonic form with its unprecedented scale and inclusion of vocal soloists and chorus.\nTags: Romanticism, Symphony\n--------------------\nQuestion: What is a symphonic poem and who developed it?\nAnswer: A symphonic poem is an orchestral work that combines music with extra-musical narratives, developed by Franz Liszt.\nTags: Romanticism, MusicalForms\n--------------------\nQuestion: Which regions developed national schools of composition during the Romantic era?\nAnswer: National schools of composition emerged in Russia, Bohemia, Norway, and other European nations, often incorporating folk melodies and national themes.\nTags: Romanticism, Nationalism\n--------------------\nQuestion: Who were some notable virtuoso performers during the Romantic era?\nAnswer: Notable virtuoso performers included pianists like Liszt and Chopin, and violinists like Paganini, known for their technical achievements.\nTags: Romanticism, Virtuosos\n--------------------\nQuestion: What concept did Wagner introduce in opera, and how did it influence other genres?\nAnswer: Wagner introduced the concept of Gesamtkunstwerk (total artwork) and leitmotifs, influencing opera, symphonic composition, and film music.\nTags: Romanticism, Opera\n--------------------\nQuestion: How did instrument construction and orchestra management change during the Romantic period?\nAnswer: Instruments like the piano and brass instruments evolved; orchestras grew larger, making conductors interpreters rather than merely timekeepers.\nTags: Romanticism, Instrumentation\n--------------------\nQuestion: How did the Romantic era influence later musical movements?\nAnswer: The breakdown of traditional tonality led to modern movements, but Romantic ideals of emotional expression and individualism continued influencing composers.\nTags: Romanticism, ModernInfluence\n--------------------\n```\n:::\n:::\n\n\n::: {#66b0e2e0 .cell execution_count=12}\n``` {.python .cell-code}\nos.makedirs('assets/flashcards', exist_ok=True)\n\n# Export flashcards to CSV file\nwith open('assets/flashcards/romantic-flashcards.csv', \n 'w', \n newline='',\n encoding='utf-8') as csvfile:\n writer = csv.writer(csvfile)\n # Write header row\n writer.writerow(['Question', 'Answer', 'Tags'])\n # Write each flashcard as a row in the CSV\n for card in romantic_deck.cards:\n writer.writerow([card.question, card.answer, ', '.join(card.tags)])\n```\n:::\n\n\n", + "supporting": [ + "index_files" + ], + "filters": [], + "includes": {} + } +} \ No newline at end of file diff --git a/docs/projects/anki/example/index.html b/docs/projects/anki/example/index.html new file mode 100644 index 0000000..f58e86c --- /dev/null +++ b/docs/projects/anki/example/index.html @@ -0,0 +1,1130 @@ + + + + + + + + + +Generate Anki flashcards: example code โ€“ Promptly Engineered + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +
+ + + +
+ +
+
+

Generate Anki flashcards: example code

+
+ + + +
+ + + + +
+ + + +
+ + +
+
import os
+import csv
+from dotenv import load_dotenv  # For loading environment variables
+from openai import OpenAI 
+
+from pydantic import BaseModel, Field
+from typing import List
+
+
+
load_dotenv()
+client = OpenAI()
+
+
+
class AnkiFlashcard(BaseModel):
+    """
+    Model representing a single Anki flashcard with question, answer, and tags.
+    """
+    # Define required fields with descriptions
+    question: str = Field(..., description="The front side of the flashcard containing the question")
+    answer: str = Field(..., description="The back side of the flashcard containing the answer")
+    tags: List[str] = Field(..., description="List of tags associated with the flashcard")
+
+
+
class AnkiDeck(BaseModel):
+    """
+    Model representing a complete Anki deck containing multiple flashcards.
+    """
+    # Define required fields with descriptions
+    cards: List[AnkiFlashcard] = Field(..., description="List of flashcards in the deck")
+    deck_name: str = Field(..., description="Name of the Anki deck")
+
+
+
def generate_structured_flashcards(text: str, 
+                                   deck_name: str, 
+                                   num_cards: int = 5) -> AnkiDeck:
+    """
+    Generate structured flashcards using GPT-4o with enforced Pydantic model output.
+    
+    Args:
+        text (str): The input text to generate flashcards from
+        deck_name (str): Name for the Anki deck
+        num_cards (int): Number of flashcards to generate (default: 5)
+        
+    Returns:
+        AnkiDeck: A structured deck of flashcards with proper validation
+        
+    Raises:
+        ValueError: If num_cards is less than 1
+    """
+    # Validate input
+    if num_cards < 1:
+        raise ValueError("Number of cards must be at least 1")
+    
+    # Make API call with structured output format
+    completion = client.beta.chat.completions.parse(
+        model="gpt-4o",
+        messages=[
+            {
+                "role": "system",
+                "content": f"""You are an expert at creating Anki flashcards. Your task is to:
+1. Read the provided text
+2. Create {num_cards} Anki flashcards that cover the main concepts
+3. Add relevant tags to each flashcard
+4. Structure the output as an Anki deck with the name "{deck_name}"."""
+            },
+            {
+                "role": "user",
+                "content": f"Please create Anki flashcards for the following text: {text}"
+            }
+        ],
+        response_format=AnkiDeck,
+    )
+    
+    # Return the parsed response
+    return completion.choices[0].message.parsed
+
+
+ +
+
+

The Romantic Era: Emotion Unleashed (1810-1910)

+

The Romantic era represented a dramatic shift in musical aesthetics, prioritizing emotional expression, individualism, and nationalism over the formal constraints of the Classical period. This century-long period saw an unprecedented expansion in the scope, scale, and emotional range of classical music.

+
+

The Romantic Spirit

+

Romanticism emerged as a reaction against the rationalism of the Enlightenment and the Industrial Revolution. Composers sought to express intense personal emotions, explore supernatural themes, and celebrate national identity through music. This new aesthetic led to the development of program music - compositions that told specific stories or painted musical pictures.

+
+
+

Expansion of Musical Language

+

The Romantic period saw a significant expansion of harmonic language. Composers pushed the boundaries of chromatic harmony, using increasingly complex chord progressions and modulations to distant keys. This development reached its apex in Wagnerโ€™s โ€œTristan und Isolde,โ€ whose famous โ€œTristan chordโ€ symbolized the dissolution of traditional tonality.

+
+
+

The Symphony Transformed

+

The symphony, inherited from the Classical era, underwent radical transformation. Beethovenโ€™s Ninth Symphony, with its unprecedented scale and inclusion of vocal soloists and chorus, set new standards for symphonic composition. Later composers like Berlioz, Mahler, and Bruckner created symphonies of enormous proportions, both in length and orchestral forces.

+
+
+

New Forms and Genres

+

The period saw the emergence of new musical forms suited to Romantic expression. The symphonic poem, developed by Franz Liszt, combined orchestral music with extra-musical narratives. The art song (Lied) reached new heights of sophistication in the hands of Schubert and Schumann, creating perfect unions of poetry and music.

+
+
+

Nationalism in Music

+

National schools of composition emerged as countries sought to express their cultural identity through music. Russian composers like Tchaikovsky and the โ€œMighty Fiveโ€ incorporated folk melodies and national themes. Similar movements appeared in Bohemia (Smetana, Dvoล™รกk), Norway (Grieg), and other European nations.

+
+
+

The Rise of the Virtuoso

+

The Romantic era celebrated individual achievement, leading to the rise of the virtuoso performer. Pianists like Liszt and Chopin composed works of unprecedented technical difficulty, while violinists like Paganini pushed the boundaries of what was possible on their instrument. This emphasis on virtuosity influenced compositional style and public performance practices.

+
+
+

Wagner and Music Drama

+

Richard Wagner revolutionized opera through his concept of Gesamtkunstwerk (total artwork), combining music, drama, poetry, and visual arts. His use of leitmotifs - recurring musical themes associated with characters, objects, or ideas - influenced not only opera but also symphonic composition and, later, film music.

+
+
+

Technical and Social Developments

+

The period saw significant developments in instrument construction. The modern piano reached its current form, while brass instruments benefited from the invention of valves. Orchestras grew larger, requiring the emergence of the conductor as an interpreter rather than merely a timekeeper.

+
+
+

The End of an Era

+

The Romantic period gradually gave way to various modern movements. The increasing chromatic harmony of late Romanticism led naturally to the breakdown of traditional tonality in the early 20th century. However, Romantic ideals of emotional expression and individualism continued to influence composers well into the modern era.

+

The Romantic eraโ€™s emphasis on emotional expression, its technical innovations, and its expansion of musical possibilities created a legacy that continues to influence musicians today. The periodโ€™s great works remain central to the concert repertoire, beloved for their emotional depth and expressive power.

+
+
+
+
+
+
romantic_deck = generate_structured_flashcards(romantic_text,
+                                              "Romanticism", 
+                                              num_cards=10)
+
+
+
romantic_deck
+
+
AnkiDeck(cards=[AnkiFlashcard(question='What major shift did the Romantic era represent in musical aesthetics?', answer='The Romantic era represented a shift towards prioritizing emotional expression, individualism, and nationalism, moving away from the formal constraints of the Classical period.', tags=['Romanticism', 'MusicAesthetics']), AnkiFlashcard(question='What is program music and how did it relate to Romanticism?', answer="Program music is a type of composition that tells specific stories or paints musical pictures, aligned with Romanticism's emphasis on emotional expression and supernatural themes.", tags=['Romanticism', 'ProgramMusic']), AnkiFlashcard(question='How did harmonic language expand during the Romantic period?', answer='Composers expanded harmonic language by pushing boundaries of chromatic harmony, using complex chord progressions and modulations, exemplified by Wagner\'s "Tristan chord."', tags=['Romanticism', 'HarmonicLanguage']), AnkiFlashcard(question='Which symphony transformed the symphonic form during the Romantic era?', answer="Beethoven's Ninth Symphony transformed the symphonic form with its unprecedented scale and inclusion of vocal soloists and chorus.", tags=['Romanticism', 'Symphony']), AnkiFlashcard(question='What is a symphonic poem and who developed it?', answer='A symphonic poem is an orchestral work that combines music with extra-musical narratives, developed by Franz Liszt.', tags=['Romanticism', 'MusicalForms']), AnkiFlashcard(question='Which regions developed national schools of composition during the Romantic era?', answer='National schools of composition emerged in Russia, Bohemia, Norway, and other European nations, often incorporating folk melodies and national themes.', tags=['Romanticism', 'Nationalism']), AnkiFlashcard(question='Who were some notable virtuoso performers during the Romantic era?', answer='Notable virtuoso performers included pianists like Liszt and Chopin, and violinists like Paganini, known for their technical achievements.', tags=['Romanticism', 'Virtuosos']), AnkiFlashcard(question='What concept did Wagner introduce in opera, and how did it influence other genres?', answer='Wagner introduced the concept of Gesamtkunstwerk (total artwork) and leitmotifs, influencing opera, symphonic composition, and film music.', tags=['Romanticism', 'Opera']), AnkiFlashcard(question='How did instrument construction and orchestra management change during the Romantic period?', answer='Instruments like the piano and brass instruments evolved; orchestras grew larger, making conductors interpreters rather than merely timekeepers.', tags=['Romanticism', 'Instrumentation']), AnkiFlashcard(question='How did the Romantic era influence later musical movements?', answer='The breakdown of traditional tonality led to modern movements, but Romantic ideals of emotional expression and individualism continued influencing composers.', tags=['Romanticism', 'ModernInfluence'])], deck_name='Romanticism')
+
+
+
+
print(romantic_deck.model_dump_json())
+
+
{"cards":[{"question":"What major shift did the Romantic era represent in musical aesthetics?","answer":"The Romantic era represented a shift towards prioritizing emotional expression, individualism, and nationalism, moving away from the formal constraints of the Classical period.","tags":["Romanticism","MusicAesthetics"]},{"question":"What is program music and how did it relate to Romanticism?","answer":"Program music is a type of composition that tells specific stories or paints musical pictures, aligned with Romanticism's emphasis on emotional expression and supernatural themes.","tags":["Romanticism","ProgramMusic"]},{"question":"How did harmonic language expand during the Romantic period?","answer":"Composers expanded harmonic language by pushing boundaries of chromatic harmony, using complex chord progressions and modulations, exemplified by Wagner's \"Tristan chord.\"","tags":["Romanticism","HarmonicLanguage"]},{"question":"Which symphony transformed the symphonic form during the Romantic era?","answer":"Beethoven's Ninth Symphony transformed the symphonic form with its unprecedented scale and inclusion of vocal soloists and chorus.","tags":["Romanticism","Symphony"]},{"question":"What is a symphonic poem and who developed it?","answer":"A symphonic poem is an orchestral work that combines music with extra-musical narratives, developed by Franz Liszt.","tags":["Romanticism","MusicalForms"]},{"question":"Which regions developed national schools of composition during the Romantic era?","answer":"National schools of composition emerged in Russia, Bohemia, Norway, and other European nations, often incorporating folk melodies and national themes.","tags":["Romanticism","Nationalism"]},{"question":"Who were some notable virtuoso performers during the Romantic era?","answer":"Notable virtuoso performers included pianists like Liszt and Chopin, and violinists like Paganini, known for their technical achievements.","tags":["Romanticism","Virtuosos"]},{"question":"What concept did Wagner introduce in opera, and how did it influence other genres?","answer":"Wagner introduced the concept of Gesamtkunstwerk (total artwork) and leitmotifs, influencing opera, symphonic composition, and film music.","tags":["Romanticism","Opera"]},{"question":"How did instrument construction and orchestra management change during the Romantic period?","answer":"Instruments like the piano and brass instruments evolved; orchestras grew larger, making conductors interpreters rather than merely timekeepers.","tags":["Romanticism","Instrumentation"]},{"question":"How did the Romantic era influence later musical movements?","answer":"The breakdown of traditional tonality led to modern movements, but Romantic ideals of emotional expression and individualism continued influencing composers.","tags":["Romanticism","ModernInfluence"]}],"deck_name":"Romanticism"}
+
+
+
+
for card in romantic_deck.cards:
+    print(f"Question: {card.question}")
+    print(f"Answer: {card.answer}")
+    print(f"Tags: {', '.join(card.tags)}")
+    print("-" * 20)
+
+
Question: What major shift did the Romantic era represent in musical aesthetics?
+Answer: The Romantic era represented a shift towards prioritizing emotional expression, individualism, and nationalism, moving away from the formal constraints of the Classical period.
+Tags: Romanticism, MusicAesthetics
+--------------------
+Question: What is program music and how did it relate to Romanticism?
+Answer: Program music is a type of composition that tells specific stories or paints musical pictures, aligned with Romanticism's emphasis on emotional expression and supernatural themes.
+Tags: Romanticism, ProgramMusic
+--------------------
+Question: How did harmonic language expand during the Romantic period?
+Answer: Composers expanded harmonic language by pushing boundaries of chromatic harmony, using complex chord progressions and modulations, exemplified by Wagner's "Tristan chord."
+Tags: Romanticism, HarmonicLanguage
+--------------------
+Question: Which symphony transformed the symphonic form during the Romantic era?
+Answer: Beethoven's Ninth Symphony transformed the symphonic form with its unprecedented scale and inclusion of vocal soloists and chorus.
+Tags: Romanticism, Symphony
+--------------------
+Question: What is a symphonic poem and who developed it?
+Answer: A symphonic poem is an orchestral work that combines music with extra-musical narratives, developed by Franz Liszt.
+Tags: Romanticism, MusicalForms
+--------------------
+Question: Which regions developed national schools of composition during the Romantic era?
+Answer: National schools of composition emerged in Russia, Bohemia, Norway, and other European nations, often incorporating folk melodies and national themes.
+Tags: Romanticism, Nationalism
+--------------------
+Question: Who were some notable virtuoso performers during the Romantic era?
+Answer: Notable virtuoso performers included pianists like Liszt and Chopin, and violinists like Paganini, known for their technical achievements.
+Tags: Romanticism, Virtuosos
+--------------------
+Question: What concept did Wagner introduce in opera, and how did it influence other genres?
+Answer: Wagner introduced the concept of Gesamtkunstwerk (total artwork) and leitmotifs, influencing opera, symphonic composition, and film music.
+Tags: Romanticism, Opera
+--------------------
+Question: How did instrument construction and orchestra management change during the Romantic period?
+Answer: Instruments like the piano and brass instruments evolved; orchestras grew larger, making conductors interpreters rather than merely timekeepers.
+Tags: Romanticism, Instrumentation
+--------------------
+Question: How did the Romantic era influence later musical movements?
+Answer: The breakdown of traditional tonality led to modern movements, but Romantic ideals of emotional expression and individualism continued influencing composers.
+Tags: Romanticism, ModernInfluence
+--------------------
+
+
+
+
os.makedirs('assets/flashcards', exist_ok=True)
+
+# Export flashcards to CSV file
+with open('assets/flashcards/romantic-flashcards.csv', 
+          'w', 
+          newline='',
+          encoding='utf-8') as csvfile:
+    writer = csv.writer(csvfile)
+    # Write header row
+    writer.writerow(['Question', 'Answer', 'Tags'])
+    # Write each flashcard as a row in the CSV
+    for card in romantic_deck.cards:
+        writer.writerow([card.question, card.answer, ', '.join(card.tags)])
+
+ + + + Back to top
+ + +
+ + + + + + \ No newline at end of file diff --git a/docs/projects/anki/index.html b/docs/projects/anki/index.html index 4b34174..de8332b 100644 --- a/docs/projects/anki/index.html +++ b/docs/projects/anki/index.html @@ -64,6 +64,7 @@ + @@ -115,26 +116,15 @@ }); @@ -432,6 +433,12 @@ Generate Anki flashcards + + @@ -1049,6 +1056,15 @@

Tasks

} }); + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 26cdea2..eed1c75 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -30,7 +30,7 @@ https://virtuelleakademie.github.io/promptly-engineered/projects/anki/index.html - 2024-11-28T07:40:30.686Z + 2024-11-28T07:46:53.077Z https://virtuelleakademie.github.io/promptly-engineered/notebooks/verify-openai.html @@ -84,4 +84,8 @@ https://virtuelleakademie.github.io/promptly-engineered/workshop/setup/index.html 2024-11-27T22:15:16.222Z + + https://virtuelleakademie.github.io/promptly-engineered/projects/anki/example/index.html + 2024-11-28T08:19:35.247Z +