pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
Word source based on a simple list of strings (stored in memory). More...
Public Member Functions | |
def | __init__ (self, words=[], max_fetch=None, shuffle=True) |
Constructor. More... | |
def | isvalid (self) |
Valid only if TextWordsource::words not empty. More... | |
def | fetch (self, word=None, blank=' ', pos=None, filter_func=None, shuffle=True, truncate=True) |
Fetches results from TextWordsource::words. More... | |
![]() | |
def | __init__ (self, max_fetch=None, shuffle=True) |
Constructor. More... | |
def | truncate (self, suggestions) |
Truncates the results by the threshold number stored in Wordsource::max_fetch. More... | |
def | shuffle (self, suggestions) |
Shuffles the results randomly. More... | |
def | check (self, word, pos=None, filter_func=None) |
Checks if a given word or word pattern is found in the word source. More... | |
def | pop_word (self, suggestions) |
Retrieves the last suggestion (word) from the list of suggestions, removing that word from the original results. More... | |
def | __repr__ (self) |
Python repr() overload. More... | |
def | __bool__ (self) |
Python bool() overload. More... | |
Public Attributes | |
words | |
list list of 2-tuples, where the first element is the source word and the second element is either a list of parts of speech or None if no part-of-speech data is available More... | |
![]() | |
max_fetch | |
int maximum number of suggestions returned from the word source More... | |
shuffle_words | |
bool if True , fetched words will be shuffled More... | |
active | |
bool if True , this word source will be used; otherwise it will be ignored More... | |
Word source based on a simple list of strings (stored in memory).
def pycross.wordsrc.TextWordsource.__init__ | ( | self, | |
words = [] , |
|||
max_fetch = None , |
|||
shuffle = True |
|||
) |
Constructor.
words | list list of source words, each of which is EITHER:
|
max_fetch | int maximum number of suggestions returned from the word source |
None
means no limit on suggestions, which may be time/resource consuming! shuffle | bool if True , fetched words will be shuffled |
def pycross.wordsrc.TextWordsource.fetch | ( | self, | |
word = None , |
|||
blank = ' ' , |
|||
pos = None , |
|||
filter_func = None , |
|||
shuffle = True , |
|||
truncate = True |
|||
) |
Fetches results from TextWordsource::words.
Reimplemented from pycross.wordsrc.Wordsource.
def pycross.wordsrc.TextWordsource.isvalid | ( | self | ) |
Valid only if TextWordsource::words not empty.
Reimplemented from pycross.wordsrc.Wordsource.
pycross.wordsrc.TextWordsource.words |
list
list of 2-tuples, where the first element is the source word and the second element is either a list of parts of speech or None
if no part-of-speech data is available