Spaces:
Sleeping
Sleeping
import streamlit as st | |
st.video("Baby Gecko Learns Poetry.mp4") | |
markdown=(""" | |
Teaching a baby gecko poetry can be a fun and rewarding experience. | |
You can start by reading poems out loud to the baby gecko, | |
choosing simple and rhythmic poems that they can easily follow along with. | |
You can also try reciting short poems to them regularly, | |
which can help them become familiar with the sounds and rhythms of poetry. | |
Additionally, you can create a comfortable and peaceful environment for the | |
baby gecko to listen to poetry. Consider playing soft music or creating a | |
calming atmosphere to enhance their learning experience. | |
Remember to be patient and consistent in your efforts to teach the | |
baby gecko poetry. With time and practice, they may start to show an interest | |
in poetry and even begin to mimic the sounds and rhythms they hear. | |
Enjoy this special bonding experience with your baby gecko as you explore | |
the world of poetry together! | |
# Baby Gecko Learns Poetry Word Game | |
## Introduction | |
In this whimsical and educational word game, players will embark on a delightful journey with Baby Gecko as they learn poetry through fun challenges and wordplay. As an expert storyteller and word game creator, my inner dialog is buzzing with creativity to bring this game to life! | |
## Game Features | |
1. π Rules | |
Description: The official guidelines that govern the gameplay and objectives of the word game. | |
2. β° Time Limit | |
Description: A constraint on the duration allowed for players to complete their turns or the entire game. | |
3. π² Dice | |
Description: Used in some word games to randomly determine letter selection or point values. | |
4. π Dictionary | |
Description: A reference book used to validate the legitimacy of words formed by players. | |
5. π Alphabet | |
Description: The set of letters used to construct words in the game, often with varying point values. | |
6. π Turn | |
Description: The opportunity for each player to form words or perform actions as per the game rules. | |
7. π§© Board | |
Description: The playing surface on which letter tiles are placed to form words in certain word games. | |
8. π Challenge | |
Description: An action that allows players to contest the validity of words formed by their opponents. | |
9. π° Score | |
Description: Points earned by players for forming valid words, often based on letter values and word length. | |
10. β Pass | |
Description: An option for players to skip their turn if unable to form a word, sometimes with penalties. | |
## Storyline | |
Once upon a time in the lush jungle, Baby Gecko found a mysterious book of poetry. Eager to learn, Baby Gecko decided to embark on a poetic adventure with friends. Each friend represented a different aspect of language - Grammar Gorilla, Vocabulary Vulture, and Syntax Sloth. | |
## Gameplay | |
Players will take turns rolling the poetic dice, which will determine the letters they can use to form words. The board will be a magical forest where players place their word tiles to create beautiful poems. Each turn, players can challenge each other's words for extra fun! | |
## Objective | |
The objective of the game is to help Baby Gecko and friends learn poetry by forming words, creating rhymes, and exploring the wonders of language. Players will earn points based on the complexity and creativity of their poems. | |
# Conclusion | |
With the combination of storytelling, wordplay, and poetry, Baby Gecko Learns Poetry is a delightful game that will not only entertain but also enhance players' language skills. Join Baby Gecko and friends on this enchanting journey through the world of words!* | |
""") | |
st.markdown(markdown) | |
# HTML5 based Speech Synthesis (Text to Speech in Browser) | |
def SpeechSynthesis(result): | |
documentHTML5=''' | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Read It Aloud</title> | |
<script type="text/javascript"> | |
function readAloud() { | |
const text = document.getElementById("textArea").value; | |
const speech = new SpeechSynthesisUtterance(text); | |
window.speechSynthesis.speak(speech); | |
} | |
</script> | |
</head> | |
<body> | |
<h1>π Read It Aloud</h1> | |
<textarea id="textArea" rows="10" cols="80"> | |
''' | |
documentHTML5 = documentHTML5 + result | |
documentHTML5 = documentHTML5 + ''' | |
</textarea> | |
<br> | |
<button onclick="readAloud()">π Read Aloud</button> | |
</body> | |
</html> | |
''' | |
st.components.v1.html(documentHTML5, width=1280, height=300) | |
SpeechSynthesis(markdown) | |
import streamlit as st | |
import random | |
# Feature 1: π Python | |
def python_feature(): | |
st.header("π Python Feature") | |
st.write("Python is a high-level programming language known for its simplicity and readability.") | |
# Feature 2: π String | |
def string_feature(): | |
st.header("π String Feature") | |
st.write("String is a data type used to represent text, essential for handling words in a word game.") | |
# Feature 3: π² Random | |
def random_feature(): | |
st.header("π² Random Feature") | |
random_number = random.randint(1, 6) | |
st.write(f"Randomly generated number: {random_number}") | |
# Create UI for each feature | |
st.title("Baby Gecko Learns Poetry Word Game") | |
python_feature() | |
string_feature() | |
random_feature() | |
# Try harder! (calling claude 3 to help w next part..) | |
import streamlit as st | |
import random | |
import string | |
st.title("Baby Gecko Learns Poetry Word Game") | |
# Feature 1: π Rules | |
st.header("π Rules") | |
st.write("Form words using the given letters within the time limit.") | |
st.write("Earn points based on the length and complexity of the words.") | |
st.write("Challenge opponents' words to gain extra points.") | |
# Feature 2: β° Time Limit | |
time_limit = 60 | |
st.header(f"β° Time Limit: {time_limit} seconds") | |
# Feature 3: π² Dice | |
dice_faces = ['A', 'B', 'C', 'D', 'E', 'F'] | |
st.header("π² Dice") | |
if st.button("Roll Dice"): | |
rolled_letter = random.choice(dice_faces) | |
st.write(f"Rolled Letter: {rolled_letter}") | |
# Feature 4: π Dictionary | |
dictionary = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig'] | |
st.header("π Dictionary") | |
st.write(f"Valid Words: {', '.join(dictionary)}") | |
# Feature 5: π Alphabet | |
alphabet = list(string.ascii_uppercase) | |
st.header("π Alphabet") | |
st.write(f"Available Letters: {', '.join(alphabet)}") | |
# Feature 6: π Turn | |
current_player = "Player 1" | |
st.header(f"π Current Turn: {current_player}") | |
# Feature 7: π§© Board | |
board = [['_' for _ in range(5)] for _ in range(5)] | |
st.header("π§© Board") | |
for row in board: | |
st.write(' '.join(row)) | |
# Feature 8: π Challenge | |
def challenge_word(): | |
challenged_word = st.text_input("Enter the word to challenge:") | |
if challenged_word in dictionary: | |
st.write(f"{challenged_word} is a valid word!") | |
else: | |
st.write(f"{challenged_word} is not a valid word!") | |
st.header("π Challenge") | |
if st.button("Challenge Word"): | |
challenge_word() | |
# Feature 9: π° Score | |
player_scores = {"Player 1": 0, "Player 2": 0} | |
st.header("π° Scores") | |
for player, score in player_scores.items(): | |
st.write(f"{player}: {score} points") | |
# Feature 10: β Pass | |
def pass_turn(): | |
global current_player | |
if current_player == "Player 1": | |
current_player = "Player 2" | |
else: | |
current_player = "Player 1" | |
st.write(f"Turn passed to {current_player}") | |
st.header("β Pass") | |
if st.button("Pass Turn"): | |
pass_turn() | |
# Feature 11: π Rhyming Words | |
rhyming_words = [ | |
("cat", "hat"), ("dog", "log"), ("play", "day"), ("night", "light"), | |
("moon", "june"), ("star", "car"), ("sun", "fun"), ("tree", "free"), | |
("sky", "high"), ("rain", "pain"), ("cloud", "proud"), ("wind", "kind"), | |
("bird", "word"), ("flower", "power"), ("grass", "class"), ("leaf", "belief"), | |
("rock", "clock"), ("water", "daughter"), ("fire", "desire"), ("earth", "birth") | |
] | |
st.header("π Top 20 Rhyming Word Pairs") | |
for pair in rhyming_words[:20]: | |
st.write(f"{pair[0]} - {pair[1]}") | |
import streamlit as st | |
import random | |
import string | |
st.title("Baby Gecko Learns Poetry Word Game") | |
# Feature 12: π Procedural Rhymes | |
st.header("π Procedural Rhymes") | |
rhyming_sounds = { | |
"ay": ["day", "play", "say", "way"], | |
"ee": ["see", "tree", "free", "me"], | |
"igh": ["high", "sky", "fly", "why"], | |
"ow": ["now", "cow", "how", "bow"], | |
"oo": ["too", "zoo", "blue", "true"], | |
"uck": ["luck", "duck", "truck", "stuck"], | |
"at": ["cat", "hat", "rat", "bat"], | |
"op": ["top", "pop", "hop", "stop"], | |
"ug": ["hug", "bug", "rug", "mug"], | |
"ink": ["think", "pink", "sink", "link"], | |
"ing": ["sing", "ring", "king", "wing"], | |
"ell": ["tell", "bell", "well", "sell"], | |
"ake": ["make", "cake", "lake", "shake"], | |
"ore": ["more", "store", "score", "bore"], | |
"ight": ["night", "light", "right", "sight"] | |
} | |
top_5_sounds = ["ay", "ee", "igh", "ow", "oo"] | |
st.subheader("Top 5 Rhyming Sound Endings") | |
for sound in top_5_sounds: | |
examples = ", ".join(rhyming_sounds[sound][:2]) | |
st.write(f"Sound: {sound} | Examples: {examples}") | |
st.subheader("Procedural Rhyme Generator") | |
selected_sound = st.selectbox("Select a rhyming sound ending:", list(rhyming_sounds.keys())) | |
num_lines = st.number_input("Enter the number of lines for the rhyme:", min_value=1, max_value=10, value=4, step=1) | |
if st.button("Generate Rhyme"): | |
rhyme_lines = [] | |
for _ in range(num_lines): | |
rhyme_word = random.choice(rhyming_sounds[selected_sound]) | |
rhyme_lines.append(rhyme_word) | |
st.subheader("Generated Rhyme") | |
st.write("\n".join(rhyme_lines)) | |
st.subheader("Reference Rhyming Word Sounds") | |
for sound, words in rhyming_sounds.items(): | |
examples = ", ".join(words[:2]) | |
st.write(f"Sound: {sound} | Examples: {examples}") | |
import streamlit as st | |
import random | |
import string | |
st.title("Baby Gecko Learns Poetry Word Game") | |
# Feature 12: π Procedural Rhymes | |
st.header("π Procedural Rhymes") | |
rhyming_sounds = { | |
"ay": ["day", "play", "say", "way"], | |
"ee": ["see", "tree", "free", "me"], | |
"igh": ["high", "sky", "fly", "why"], | |
"ow": ["now", "cow", "how", "bow"], | |
"oo": ["too", "zoo", "blue", "true"], | |
"uck": ["luck", "duck", "truck", "stuck"], | |
"at": ["cat", "hat", "rat", "bat"], | |
"op": ["top", "pop", "hop", "stop"], | |
"ug": ["hug", "bug", "rug", "mug"], | |
"ink": ["think", "pink", "sink", "link"], | |
"ing": ["sing", "ring", "king", "wing"], | |
"ell": ["tell", "bell", "well", "sell"], | |
"ake": ["make", "cake", "lake", "shake"], | |
"ore": ["more", "store", "score", "bore"], | |
"ight": ["night", "light", "right", "sight"] | |
} | |
top_5_sounds = ["ay", "ee", "igh", "ow", "oo"] | |
st.subheader("Top 5 Rhyming Sound Endings") | |
for sound in top_5_sounds: | |
examples = ", ".join(rhyming_sounds[sound][:2]) | |
st.write(f"Sound: {sound} | Examples: {examples}") | |
st.subheader("Procedural Rhyme Generator") | |
selected_sound = st.selectbox(key='rhymegenerator', "Select a rhyming sound ending:", list(rhyming_sounds.keys()) | |
num_lines = st.number_input("Enter the number of lines for the rhyme:", min_value=1, max_value=10, value=4, step=1) | |
if st.button("Generate Rhyme"): | |
rhyme_lines = [] | |
for _ in range(num_lines): | |
rhyme_word = random.choice(rhyming_sounds[selected_sound]) | |
rhyme_lines.append(rhyme_word) | |
st.subheader("Generated Rhyme") | |
st.write("\n".join(rhyme_lines)) | |
st.subheader("Reference Rhyming Word Sounds") | |
for sound, words in rhyming_sounds.items(): | |
examples = ", ".join(words[:2]) | |
st.write(f"Sound: {sound} | Examples: {examples}") | |
# Feature 13: π Sentence Structures | |
st.header("π Sentence Structures") | |
sentence_structures = [ | |
"The [adjective] [noun] [verb] [adverb].", | |
"[Noun] [verb] [preposition] the [adjective] [noun].", | |
"[Adverb], the [noun] [verb] [preposition] the [noun].", | |
"In the [noun], [noun] [verb] [adverb]." | |
] | |
st.subheader("Example Sentence Structures") | |
for structure in sentence_structures: | |
st.write(structure) | |
st.subheader("Procedural Poetry Generator") | |
selected_structure = st.selectbox("Select a sentence structure:", sentence_structures) | |
if st.button("Generate Poetry"): | |
poetry_lines = [] | |
for _ in range(4): | |
line = selected_structure | |
line = line.replace("[adjective]", random.choice(["happy", "shiny", "graceful", "gentle"])) | |
line = line.replace("[noun]", random.choice(["gecko", "butterfly", "rainbow", "breeze"])) | |
line = line.replace("[verb]", random.choice(["dances", "sings", "glides", "whispers"])) | |
line = line.replace("[adverb]", random.choice(["joyfully", "softly", "elegantly", "quietly"])) | |
line = line.replace("[preposition]", random.choice(["on", "under", "above", "through"])) | |
poetry_lines.append(line) | |
st.subheader("Generated Poetry") | |
st.write("\n".join(poetry_lines)) | |
# Feature 14: π Rhyming Word Lists for Graphic Novels | |
st.header("π Rhyming Word Lists for Graphic Novels") | |
graphic_novel_rhymes = { | |
"Adventure": ["quest", "best", "test", "west"], | |
"Mystery": ["clue", "true", "new", "who"], | |
"Fantasy": ["dream", "gleam", "scheme", "supreme"], | |
"Science Fiction": ["space", "race", "place", "chase"], | |
"Romance": ["heart", "start", "art", "part"] | |
} | |
st.subheader("Rhyming Word Lists") | |
for genre, words in graphic_novel_rhymes.items(): | |
st.write(f"{genre}: {', '.join(words)}") | |
import streamlit as st | |
import random | |
import string | |
st.title("Baby Gecko Learns Poetry Word Game") | |
# ... (previous code remains the same) ... | |
# Feature 15: π Story Generator | |
st.header("π Story Generator") | |
story_parts = { | |
"beginning": [ | |
"In the realm of [noun], where [adjective] [noun_plural] roam, a [adjective] [noun] embarks on an epic journey.", | |
"Amidst the [adjective] [noun], a [noun] of unparalleled [noun] emerges, seeking to [verb] the world.", | |
"In a world fraught with [noun], a [adjective] [noun] arises, determined to [verb] the forces of [noun]." | |
], | |
"middle": [ | |
"Endowed with [adjective] [noun], the [noun] [verb_past] through the [adjective] [noun], encountering [noun_plural] and [noun_plural].", | |
"With [noun] as their guide, the [noun] [verb_past] the [adjective] [noun], unraveling the secrets of [noun].", | |
"Confronted by the [adjective] [noun], the [noun] must [verb] their [noun] and [verb] the [adjective] [noun]." | |
], | |
"end": [ | |
"In a climactic battle of [noun] and [noun], the [noun] [verb_past] the [adjective] [noun], emerging [adjective] and [adjective].", | |
"With the power of [noun] and [noun], the [noun] [verb_past] the [adjective] [noun], ushering in an era of [noun] and [noun].", | |
"Forever changed by their [adjective] journey, the [noun] [verb_past] home, their [noun] forever etched in the annals of [noun]." | |
] | |
} | |
vocabulary = { | |
"noun": ["quintessence", "paradigm", "phenomenon", "cognizance", "providence", "iniquity", "juxtaposition", "obfuscation", "rescission", "volition"], | |
"noun_plural": ["axioms", "dichotomies", "ephemera", "hermeneutics", "ontologies", "paradoxes", "semiotics", "tautologies", "vicissitudes", "zeitgeists"], | |
"adjective": ["abstruse", "Byzantine", "chimerical", "draconian", "ephemeral", "inexorable", "labyrinthine", "mercurial", "quixotic", "turgid"], | |
"verb": ["amalgamate", "bifurcate", "coalesce", "deconstruct", "extrapolate", "juxtapose", "metamorphose", "obfuscate", "reify", "transmogrify"], | |
"verb_past": ["amalgamated", "bifurcated", "coalesced", "deconstructed", "extrapolated", "juxtaposed", "metamorphosed", "obfuscated", "reified", "transmogrified"] | |
} | |
story_structure = ["beginning", "middle", "end"] | |
if st.button("Generate Story"): | |
story_paragraphs = [] | |
for part in story_structure: | |
paragraph = [] | |
for _ in range(3): | |
sentence = random.choice(story_parts[part]) | |
for word_type in ["noun", "noun_plural", "adjective", "verb", "verb_past"]: | |
sentence = sentence.replace(f"[{word_type}]", random.choice(vocabulary[word_type])) | |
paragraph.append(sentence) | |
story_paragraphs.append(" ".join(paragraph)) | |
st.subheader("Generated Story") | |
st.write("\n\n".join(story_paragraphs)) | |
import streamlit as st | |
import random | |
import string | |
st.title("Baby Gecko's Continual Story Generator") | |
# Story Parts | |
story_parts = { | |
"beginning": [ | |
"In the realm of [noun], where [idiom], a [adjective] [noun] embarks on an epic journey.", | |
"Amidst the [adjective] [noun], a [noun] of unparalleled [noun] emerges, seeking to [rhyme].", | |
"In a world fraught with [noun], a [adjective] [noun] arises, determined to [idiom]." | |
], | |
"middle": [ | |
"Endowed with [adjective] [noun], the [noun] [verb_past] through the [adjective] [noun], [rhyme].", | |
"With [noun] as their guide, the [noun] [verb_past] the [adjective] [noun], unraveling the secrets of [noun].", | |
"Confronted by the [adjective] [noun], the [noun] must [idiom] and [rhyme]." | |
], | |
"end": [ | |
"In a climactic battle of [noun] and [noun], the [noun] [verb_past] the [adjective] [noun], emerging [adjective] and [adjective].", | |
"With the power of [noun] and [noun], the [noun] [verb_past] the [adjective] [noun], [rhyme].", | |
"Forever changed by their [adjective] journey, the [noun] [verb_past] home, their [noun] forever etched in the annals of [noun]." | |
] | |
} | |
# Vocabulary | |
vocabulary = { | |
"noun": ["quintessence", "paradigm", "phenomenon", "cognizance", "providence", "iniquity", "juxtaposition", "obfuscation", "rescission", "volition"], | |
"adjective": ["abstruse", "Byzantine", "chimerical", "draconian", "ephemeral", "inexorable", "labyrinthine", "mercurial", "quixotic", "turgid"], | |
"verb_past": ["amalgamated", "bifurcated", "coalesced", "deconstructed", "extrapolated", "juxtaposed", "metamorphosed", "obfuscated", "reified", "transmogrified"], | |
"idiom": ["the cat's out of the bag", "a penny for your thoughts", "the elephant in the room", "a leopard can't change its spots", "the writing is on the wall", "a blessing in disguise", "a fish out of water", "a wild goose chase", "a square peg in a round hole", "a needle in a haystack"] | |
} | |
# Rhyme Generation (L-System Grammar) | |
def generate_rhyme(axiom, rules, iterations): | |
rhyme = axiom | |
for _ in range(iterations): | |
new_rhyme = "" | |
for char in rhyme: | |
new_rhyme += rules.get(char, char) | |
rhyme = new_rhyme | |
return rhyme | |
rhyme_axioms = ["A", "B", "C", "D", "E"] | |
rhyme_rules = { | |
"A": "[adjective] [noun]", | |
"B": "[verb_past] with [noun]", | |
"C": "in the [adjective] [noun]", | |
"D": "where [noun] [verb_past]", | |
"E": "and [adjective] [noun] [verb_past]" | |
} | |
# Story Generation | |
def generate_story(): | |
story_paragraphs = [] | |
for part in story_parts: | |
paragraph = [] | |
for sentence_template in story_parts[part]: | |
sentence = sentence_template | |
for word_type in vocabulary: | |
if f"[{word_type}]" in sentence: | |
word = random.choice(vocabulary[word_type]) | |
sentence = sentence.replace(f"[{word_type}]", word, 1) | |
if "[rhyme]" in sentence: | |
axiom = random.choice(rhyme_axioms) | |
rhyme = generate_rhyme(axiom, rhyme_rules, random.randint(1, 3)) | |
sentence = sentence.replace("[rhyme]", rhyme, 1) | |
paragraph.append(sentence) | |
story_paragraphs.append(" ".join(paragraph)) | |
return "\n\n".join(story_paragraphs) | |
# Streamlit App | |
if st.button("Generate Story"): | |
story = generate_story() | |
st.subheader("Generated Story") | |
st.write(story) | |