3.9.3. Word source preference
When generating a crossword (filling in the blank words in the current grid),
pycrossword uses
all the currently active word sources (those checked in the
Word Source Manager). However, these sources aren't just mixed pell-mell, but used according to their priority in the Word Source Manager. The priority can be raised or lowered using the and buttons in the
.
To understand how this works, it's better to use an example. Let's say you have three active word sources: one list-based named "englist", one text file-based named "eng20", and one database named "en_db". The sources are ordered like shown below:
Fig. 3.9.3.1. Example with word sources of different types
The higher the position of a source, the higher its precedence (priority) in search operations. With this setup, the search engine will first look among words in "
englist", then pass on to "
eng20", and finally search the database "
en_db". If the maximum number of search results is
constrained to a threshold value (say,
500), then the resulting list of matches will be
truncated from the bottom, affecting the lower-priority sources first. Thus, if our custom "
englist" word list contains the 4 words shown in the
previous example, they will appear at the top of the search results and will not be affected by top-500 truncation.
Let's find
suggestions for a 4-letter word in our crossword. The suggested words reflect the matches found by the search engine honoring the priority of the word sources used. So the topmost 4 results are the 4 words contained in the "
englist" source; the runner-up is "
eng20", and the results in "
en_db" are severely chopped off with the top-500 truncation (the total number being 500 minus the results in "
englist" and "
eng20"):
Fig. 3.9.3.2. Matches reflect word source priority
Of course, if you turn off truncation, the search engine will handle all the matches it gets from all the active sources; but even here, the words coming first in the results will be tried first in the crossword grid during generation, so lower-priority words have lower chances.