API
FiveLetterWorda.WordCombinationFiveLetterWorda.adjacency_matrixFiveLetterWorda.cliquesFiveLetterWorda.cliques!FiveLetterWorda.mainFiveLetterWorda.n_letter_wordsFiveLetterWorda.ncharsFiveLetterWorda.nwordsFiveLetterWorda.remove_anagramsFiveLetterWorda.write_tab
FiveLetterWorda.WordCombination — Type
WordCombination
WordCombination()
WordCombination(w::String)
WordCombination(ws::AbstractVector{String})A conveniencce data type for a set of words and associated characters.
Fields:
chars::Set{Char}words::Set{String}
FiveLetterWorda.adjacency_matrix — Function
adjacency_matrix(words, T::Type{<:AbstractMatrix}=BitMatrix; progress=true)Compute the adjacency matrix.
Default is BitMatrix, which is a memory dense format, but which can be slower to read individual elements. Another alternative is Matrix{Bool}, which is noticably faster for reading individual elements but requires 8 times the storage space.
FiveLetterWorda.cliques — Function
cliques(adj, wordlist, order=5; progress=true)Find all five-cliques in the adjacency matrix adj.
The cliques are interpreted as entries in wordlist (so the adjacency matrix should reflect the same ordering as wordlist) and the results are then returned as the relevant words.
FiveLetterWorda.cliques! — Function
cliques!(results::Vector{Vector{String}}, adj, wordlist, order=5;
progress=true)Find all order-cliques in the adjacency matrix adj, storing the result in results.
See also cliques
FiveLetterWorda.main — Function
main(n=5; exclude_anagrams=true,
adjacency_matrix_type=Matrix{Bool}, order=fld(26, n),
progress=true)Do everything. 😉
Find the set of groups of order n-letter words where each group of words has no shared letters between words.
If exclude_anagrams=true, then anagrams are removed from the word list before finding the result.
You can specify the storage type of the adjaceny matrix with adjacency_matrix_type. BitMatrix, is very dense in memory, packing eight vertices into a single byte. Matrix{Bool} stores one vertex per byte and is thus 8 times as large, but noticably faster. See also adjacency_matrix
The order specifies the order of cliques to find and defaults to fld(26, n), i.e. the maximal possible order for a given word length. Note that cliques of lower order are more common, so there are many more of them.
Returns a named tuple of containing
- the adjacency matrix
adjof words, i.e. the matrix of indicators for whether a given pair of words have no letters in common - the vector of words used
words - the vector of
WordCombinations found.
FiveLetterWorda.n_letter_words — Method
n_letter_words()Return the set of n-letter words containing n unique letters.
Use remove_anagrams to remove anagrams.
FiveLetterWorda.nchars — Method
FiveLetterWorda.nwords — Method
FiveLetterWorda.remove_anagrams — Method
remove_anagrams(words::Vector{String})Remove all anagrams from words.
This reduces the set of words to the set of equivalence classes under the operation "anagram". The representative member from each class is just the first word encountered from that class. If the vector is sorted lexicographically, then this is just the anagram that comes first in the alphabet.
FiveLetterWorda.write_tab — Method
write_tab(fname, wcs::Vector{Vector{String}})
write_tab(fname, wcs::Vector{WordCollection})Write the results out to a tab delimited file.