Skip to content

Feature: Random Text Generation with AI / API #66#76

Merged
FOSSCLUB-LBSITW merged 2 commits into
FOSSCLUB-LBSITW:mainfrom
adithyen:Feature-Random-Text-Generation-with-AI-/-API-#66
Mar 13, 2026
Merged

Feature: Random Text Generation with AI / API #66#76
FOSSCLUB-LBSITW merged 2 commits into
FOSSCLUB-LBSITW:mainfrom
adithyen:Feature-Random-Text-Generation-with-AI-/-API-#66

Conversation

@adithyen
Copy link
Copy Markdown
Contributor

📌 Description

Brief description of what this PR does.
Adds a template-based random text generator using a local word bank of 200+
common English words organized by category (nouns, verbs, adjectives, adverbs,
connectors, prepositions, determiners). Sixteen sentence templates produce
grammatically sensible but completely unpredictable text, eliminating the
memorization problem with static sentences.

Users can switch between "Random Generated" and "Classic Static" modes
via a new dropdown in the settings panel.

🔗 Related Issue

Closes: #66


Combinatorial Analysis

Component Pool Size
Nouns 73
Verbs 53
Adjectives 41
Adverbs 26
Connectors 23
Prepositions 20
Determiners 15
Templates 16

Per-sentence combinations: 16 × 73 × 53 × 41 × 26 × 23 × 20 × 15
= ~232 billion unique sentences

For a "Long Text" (7-10 sentences), the combinations are astronomically large —
memorization is effectively impossible.

Changes Made

New Components

Component Description
WORD_BANK (dict) 200+ common English words in 7 categories
SENTENCE_TEMPLATES (list) 16 sentence structure templates with {placeholders}
generate_sentence() Picks random template + random words → one sentence
generate_text(mode) Generates 1 / 3-5 / 7-10 sentences based on text length mode
STATIC_TEXT_POOLS Renamed from TEXT_POOLS — the original static texts preserved
TEXT_SOURCE_OPTIONS ["Random Generated", "Classic Static"]
self.text_source_var StringVar for text source dropdown
self.text_source_menu CTkOptionMenu in settings frame (row 1)
self.get_test_text() Routes to generator or static pool based on selected source

Modified Components

Component What Changed
self.settings_frame Added row 1 with "Text Source" label + dropdown
begin_test() Now calls self.get_test_text() instead of directly accessing pool
start_test() Also disables/enables self.text_source_menu during test
check_result() Also re-enables self.text_source_menu on completion
Window geometry 750×720780×750 (fits extra settings row)
Sentence frame 680×120700×130 (slightly larger for longer generated text)
Input box width 660680 (proportional)

No Changes To

  • calculate_current_wpm() — unchanged
  • update_live_wpm() — unchanged
  • update_timer() — unchanged
  • toggle_pause() — unchanged
  • handle_typing() — unchanged
  • update_sentence_display() — unchanged
  • update_streaks() — unchanged
  • load_data() / save_data() — unchanged
  • streak_data.json schema — unchanged
  • beep() wrapper — unchanged
  • DURATION_OPTIONS — unchanged
  • TEXT_LENGTH_OPTIONS — unchanged

📷 Screenshots (if applicable)

image

✅ Checklist

  • I have tested my changes
  • My code follows project guidelines
  • I have linked the related issue

@FOSSCLUB-LBSITW
Copy link
Copy Markdown
Owner

hey!there is some merge conflict here. Please resolve it as soon as possible

@FOSSCLUB-LBSITW FOSSCLUB-LBSITW merged commit 4fb5732 into FOSSCLUB-LBSITW:main Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Random Text Generation with AI / API

2 participants