|
|
|
@ -15,8 +15,6 @@ extra_words = pathlib.Path(__file__, '..', 'extra_words.txt') |
|
|
|
|
|
|
|
def do_operation(obj, bound_method, *args, **kwargs): |
|
|
|
bound_method(*args, **kwargs) |
|
|
|
import time |
|
|
|
time.sleep(60) |
|
|
|
return obj |
|
|
|
|
|
|
|
|
|
|
|
@ -37,9 +35,15 @@ class Dictionary: |
|
|
|
self._word_frequency = self.future.result() |
|
|
|
return self._word_frequency |
|
|
|
|
|
|
|
def filter(self, wordlist): |
|
|
|
def filter(self, wordlist, excludes=None): |
|
|
|
"""Finds words that are in the dictionary""" |
|
|
|
return set(filter(wordlist, lambda word: word in self.word_frequency)) |
|
|
|
if excludes is None: |
|
|
|
|
|
|
|
def filter_func(word): return word in self.word_frequency |
|
|
|
else: |
|
|
|
def filter_func( |
|
|
|
word): return word not in excludes and word in self.word_frequency |
|
|
|
return set(filter(filter_func, wordlist)) |
|
|
|
|
|
|
|
|
|
|
|
DEFAULT = Dictionary(default_load_future) |
|
|
|
|