This package provides a large English words list and tools to find words by patterns. In particular, anagram finder and scrabble word finder.
devtools::install_github("idmn/wfindr")
Describe a pattern that a word should match by marking unknown letters.
"."
.{...}
repetition quantifier. Namely, .{n}
means exactly n unknown letters, .{n,}
- n or more, .{n, m}
- from n to m.*
denotes unknown number of unknown letters.Then pass this pattern to a find_word
function. Examples:
#> words starting with "aa"
find_word("aa*")
#> 4-letter words stating with "w" and ending with "d"
find_word("w..d")
#> 30 or more letter words
find_word(".{30,}")
You can also specify letters that you don't want to be used to fill the gaps with ban
argument.
find_word("w..d", ban = "oe")
Or you can determine the list of letters to be used with allow
argument.
find_word("w..d", allow = "oe")
To find words that can be constructed from the specified set of letters, use scrabble
function
#> words constructed from the "thing" word's letters
scrabble("thing")
This function is actually built on top of the find_word
function. To give you an idea, the previous call is equivalent to this:
find_word(allow = "thing", type = "scrabble")
It is also possible to specify a pattern in scrabble
, as it was in find_word
. For, example, to get at least 4-letter words:
scrabble("thing", ".{4,}")
To find anagrams, use anagram
function.
anagram("thing")
This function is also built on top of find_word
and the previous call is equivalent to
find_word(allow = "thing", type = "anagram")