A multithreaded Python script for generating valid Polish words using a dictionary trie and morphological analysis.
- Generates Polish words randomly using the full Polish alphabet.
- Ensures words pass morphological analysis with
morfeusz2. - Filters out rejected words and avoids words with unnatural letter patterns.
- Uses multithreading for faster word generation.
- Displays live progress with a terminal progress bar (
tqdm) and colorful output. - Highly customizable: set minimum words and minimum letters in the word.
Install the dependencies listed in requirements.txt:
pip install -r requirements.txtDependencies include:
-
marisa_trie -
morfeusz2 -
tqdm
python word_hunt.py <min_words_to_generate> <min_letters_in_word>Example:
python word_hunt.py 50 4This generates 50 Polish words, each with at leasts 4 letters.
The script prints live updates for each thread:
-
Found word (magenta and bold)
-
Progress: number of words found
-
Number of retries
-
Time taken at the end
Example output:
[Thread-1] Found word: kot
[Thread-1] Progress: 1/50 words found
[Thread-1] Retries: 15
Time taken: 2.34 sec
Found words: ['kot', 'pies', 'dom', ...]-
Loads Polish words from PL.txt into a trie for fast lookup.
-
Loads rejected words from rejected.txt.
-
Generates random words using the Polish alphabet.
-
Checks each word with morfeusz2 for valid morphological forms.
-
Uses threading to parallelize word generation.
-
Stops when the minimum number of words is reached.
-
Make sure PL.txt and rejected.txt are in the same folder as the script.
-
Avoid setting min_letters_in_word below 3; words shorter than 3 letters are ignored.
-
The script uses colorful terminal output—best viewed in terminals that support ANSI escape codes.
More about LICENSE