scrabble: Find words that can be constructed from the specified letters

Description Usage Arguments Details See Also Examples

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

1
2
3
4
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 . stands for unknown character. It may be followed by {...} repetition quantifier (i.e. .{n}, .{n,}, .{n,m}). Asterisk * stands for unknown number of unknown characters. See examples.
By default model is set to "*".

ban

characters not allowed to fill gaps in a word.

words

vector of words to search within. By default is set to words.eng.

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

find_word

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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")

wfindr documentation built on May 2, 2019, 12:20 p.m.