Word source generated from a text file.
More...
|
| def | __init__ (self, path, enc='utf-8', delimiter=' ', max_fetch=None, shuffle=True) |
| | Constructor. More...
|
| |
| 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...
|
| |
|
| | words |
| |
| | bpos |
| |
| | bpos |
| | bool True if the source word list contains part-of-speech data More...
|
| |
| | 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 generated from a text file.
Derives from TextWordsource, so all members are implemented without change.
◆ __init__()
| def pycross.wordsrc.TextfileWordsource.__init__ |
( |
|
self, |
|
|
|
path, |
|
|
|
enc = 'utf-8', |
|
|
|
delimiter = ' ', |
|
|
|
max_fetch = None, |
|
|
|
shuffle = True |
|
) |
| |
Constructor.
- Parameters
-
| path | str full path to the source text file |
| enc | str file encoding (default = UTF8) |
| delimiter | str field delimiter character in text file (default = whitespace) |
| max_fetch | int maximum number of suggestions returned from the word source |
- Warning
None means no limit on suggestions, which may be time/resource consuming!
- Parameters
-
| shuffle | bool if True, fetched words will be shuffled |
◆ bpos
| pycross.wordsrc.TextfileWordsource.bpos |
◆ words
| pycross.wordsrc.TextfileWordsource.words |
The documentation for this class was generated from the following file: