scrabble {wfindr} | R Documentation |
Find words that can be constructed from the specified letters
Description
scrabble
finds words that can be constructed from the
specified set of letters.
anagram
finds words that are
permutations of the specified set of letters. Usually this set of letters
is a word itself.
Usage
scrabble(allow, model = "*", ban = character(0),
words = wfindr::words.eng)
anagram(allow, model = "*", ban = character(0), words = wfindr::words.eng)
Arguments
allow |
characters allowed to use to construct words. |
model |
pattern that a word should match. Consists of letters and
unknown characters specifications. Dot |
ban |
characters not allowed to fill gaps in a word. |
words |
vector of words to search within. By default is set to
|
Details
scrabble
and anagram
are functions built on top of the
find_word
function with parameter type
set to
"scrabble"
or "anagram"
respectively and allow
parameter moved to the first place to simplify usage (see the first
example).
See Also
Examples
## Find all words that can be constructed of the "thing" word's letters
scrabble("thing")
## same as
find_word(allow = "thing", type = "s")
## take at least 4-letter words
scrabble("thing", ".{4,}")
## same as
find_word(".{4,}", "thing", type = "s")
## Pick 8 random letters and find words that can be constructed of them.
library(magrittr)
sample(letters, 8, TRUE) %>% list(letters = ., words = scrabble(.))
## Find anagrams of the word "thing"
anagram("thing")