um-computacion-tm/scrabble-2023-meschinidino

View on GitHub
game/dictionary.py

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class Dictionary:
    def __init__(self, file_path):
        self.words = self.load_words(file_path)

    @staticmethod
    def load_words(file_path):
        with open(file_path, 'r', encoding='utf-8') as file:
            return set(word.strip() for word in file)

    def has_word(self, word):
        return word in self.words