fix(P1): score or 0.0 idiom (#71) + distinct MEDIUM word list (#69)#76
Merged
FlorentPoinsaut merged 4 commits intomainfrom May 4, 2026
Merged
Conversation
- Add `SemanticEngine.is_in_vocab(word)` method for explicit vocabulary lookup - Add `is_in_vocab` to `Scorer` protocol so implementors expose it - Expose `GameState.scorer` property so bot can access the scorer - Filter OOV words in `start_game` using `is_in_vocab()` before `random.choice()`; sends a clear error message if no playable words remain - Add tests: `TestSemanticEngineIsInVocab` and `TestStartOovFiltering`
'score or 0.0' uses Python truthiness, not a None check. top_guesses() already filters out None scores, so the fallback was unreachable dead code. Replace with direct attribute access in all three locations. Closes #71
MEDIUM and HARD both pointed to interest_words_d.txt, making the two difficulty levels indistinguishable. Add data/interest_words_m.txt with 34 semi-concrete French nouns that sit between the easy and hard registers (no overlap with either list, all in-vocabulary for frWac). Also accept 'medium' in setdifficulty (previously only easy/hard were accepted there), and update _validate_difficulty to derive the valid set dynamically from the Difficulty enum so future additions are automatically covered. Closes #69
5150a1a to
8bd7f23
Compare
Co-authored-by: Copilot <copilot@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two P1 issues identified during code review.
Fix #71 —
score or 0.0is a semantically incorrect idiomFiles:
game/state.py,bot/bot.pyscore or 0.0uses Python truthiness (bool(0.0) == False), not aNone-guard.top_guesses()already filters entries withscore is Nonebefore returning, so the fallback was unreachable dead code in all three locations. Replaced with direct attribute access (e.score,best.score).Reviewed by: [Tech] Reviewer agent
Fix #69 — MEDIUM and HARD use the same word list
Files:
bot/bot.py,data/interest_words_m.txt(new),tests/test_commands.pydata/interest_words_m.txt: 34 semi-concrete French nouns (no OOV risk in frWac, zero overlap with EASY/HARD lists) designed by the [Tech] NLP/Data agent._WORD_LIST_FILES[Difficulty.MEDIUM]now points tointerest_words_m.txt._validate_difficultynow derives valid values dynamically fromDifficultyenum — future enum additions are automatically covered.setdifficultynow acceptsmediumin addition toeasyandhard.test_medium_is_invalid→test_medium_is_valid,test_invalid_difficulty_rejecteduses a genuinely invalid value, addedtest_valid_medium_accepted.Reviewed by: [Tech] NLP/Data agent
Tests
268 passed, 0 failed — coverage 92 %
Closes #71
Closes #69