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):
80
             corpus_slug = 'classic'  # Fallback
80
             corpus_slug = 'classic'  # Fallback
81
             logger.warning(f"Corpus '{corpus_slug}' not found, falling back to classic")
81
             logger.warning(f"Corpus '{corpus_slug}' not found, falling back to classic")
82
 
82
 
83
-        # Community word logic (only for classic corpus)
83
+        # Community word logic (works for all corpora)
84
-        use_community = corpus_slug == 'classic' and random.random() < 0.35 and not seed
84
+        use_community = random.random() < 0.35 and not seed
85
         
85
         
86
         # Debug logging
86
         # Debug logging
87
         if use_community:
87
         if use_community:
88
             total_community_words = JubJubWord.objects.filter(
88
             total_community_words = JubJubWord.objects.filter(
89
                 copy_count__gt=0,
89
                 copy_count__gt=0,
90
-                corpus__slug='classic'
90
+                corpus__slug=corpus_slug
91
             ).count()
91
             ).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}")
93
         
93
         
94
         # Max attempts to avoid infinite loops
94
         # Max attempts to avoid infinite loops
95
         max_generation_attempts = 20
95
         max_generation_attempts = 20
@@ -99,7 +99,7 @@ def generate_words(request):
99
             generation_attempts += 1
99
             generation_attempts += 1
100
             
100
             
101
             if use_community:
101
             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
103
                 query = JubJubWord.objects.filter(
103
                 query = JubJubWord.objects.filter(
104
                     Q(copy_count__gt=0) | Q(definition_count__gt=0)
104
                     Q(copy_count__gt=0) | Q(definition_count__gt=0)
105
                 )
105
                 )