tenseleyflow/jubjubword / 4cec66b

Browse files

Enable community words for all corpus categories

Previously, community words (popular words that users have copied or
defined) were only shown when using the 'classic' corpus. This change
enables community word features across all corpus categories (food,
scifi, etc.), allowing each corpus to build its own community of
popular words.

Changes:
- Removed corpus_slug == 'classic' restriction from community logic
- Updated debug logging to track community words by corpus
- Updated comments to reflect multi-corpus support

Co-authored-by: mfwolffe <wolffemf@dukes.jmu.edu>
Co-authored-by: espadonne <espadonne@outlook.com>
Authored by Claude <noreply@anthropic.com>
SHA
4cec66b1d3d5da819b4939e4b2f9d2106825b8aa
Parents
ebde171
Tree
de7ff36

1 changed file

StatusFile+-
M backend/jubjub/jubjubword/views.py 5 5
backend/jubjub/jubjubword/views.pymodified
@@ -80,16 +80,16 @@ def generate_words(request):
8080
             corpus_slug = 'classic'  # Fallback
8181
             logger.warning(f"Corpus '{corpus_slug}' not found, falling back to classic")
8282
 
83
-        # Community word logic (only for classic corpus)
84
-        use_community = corpus_slug == 'classic' and random.random() < 0.35 and not seed
83
+        # Community word logic (works for all corpora)
84
+        use_community = random.random() < 0.35 and not seed
8585
         
8686
         # Debug logging
8787
         if use_community:
8888
             total_community_words = JubJubWord.objects.filter(
8989
                 copy_count__gt=0,
90
-                corpus__slug='classic'
90
+                corpus__slug=corpus_slug
9191
             ).count()
92
-            logger.info(f"Attempting community word selection. Total available: {total_community_words}")
92
+            logger.info(f"Attempting community word selection from {corpus_slug}. Total available: {total_community_words}")
9393
         
9494
         # Max attempts to avoid infinite loops
9595
         max_generation_attempts = 20
@@ -99,7 +99,7 @@ def generate_words(request):
9999
             generation_attempts += 1
100100
             
101101
             if use_community:
102
-                # Try to get a popular community word from classic corpus
102
+                # Try to get a popular community word from selected corpus
103103
                 query = JubJubWord.objects.filter(
104104
                     Q(copy_count__gt=0) | Q(definition_count__gt=0)
105105
                 )