Message Boards Message Boards

GROUPS:

How do I use DictionaryLookup to exclude words with certain phrases?

Posted 8 years ago
4454 Views
|
2 Replies
|
2 Total Likes
|

I'm looking to use DictionaryLookup to search the English dictionary for words that don't contain certain strings. For example, I want to exclude "ar" and "h" from my search, and have "far" and "hat" not appear. (I'm going to have a long list of strings, so my search result will be limited down significantly.)

Finally, I'm looking to sort these results by word length. Any help getting started doing this is much appreciated!

POSTED BY: F P
2 Replies
Posted 8 years ago

I just got it! Thanks, though!

enter image description here

POSTED BY: F P

Try something like:

tmp = DictionaryLookup[];
tmp // Length
tmp = Select[tmp, StringFreeQ[#, "ar"] &];
tmp // Length
tmp = Select[tmp, StringFreeQ[#, "h"] &];
tmp // Length
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract