pmaher86 / blacksquare

A Python package for crossword creators.
MIT License
38 stars 13 forks source link

Allow WordLists to be combined #14

Closed wom-bat closed 1 year ago

wom-bat commented 1 year ago

If I want to make a thematic crossword, then I'd like to be able to provide a list of words to be used preferentially, but if none fit, then the fill() function should use the default list. Easiest way to do this (I think) would be to enable WordLists to be merged: if all the scores to the preferred words are '1', then they're most likely to be chosen (I think).

So for a Hamlet-themed crossword you could do

hamletwords = [ "Hamlet", "Polonius", "ghost", "murdermostfoul" , "tobeornottobe", ...]
hamletWordlist = WordList(hamletwords)
xw.fill(word_list= hamletWordList + DEFAULT_WORD_LIST)

or similar. (this assumes overloading +, but one could use a function instead.)

pmaher86 commented 1 year ago

Good suggestion, implemented in v0.4.0.