Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.4K Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

A String pattern that matches words between lexical limits?

Posted 5 years ago

I need a string pattern that matches words lying between a lower word lW and an upper word uW. Ordering is the standard lexical (alphabetic) order.

The following pattern does the job, but takes a long time if a large word base is used. Actually, I need the pattern for DictionaryLookup in natural languages.

Block[{lW = "Zyniker", uW = "Zypresse"},
 StringMatchQ[{"zylindrisch", "zynisch", "Zypern", "Zyste"}, 
  w__ /; AlphabeticOrder[lW, w, IgnoreCase -> True] == 1 && 
    AlphabeticOrder[w, uW, IgnoreCase -> True] == 1]
 ]
{False, True, True, False}

Is there some more elegant and fast pattern?

POSTED BY: Werner Geiger
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard