MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: help with DictionaryLookup[] and a type of regular expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109677] Re: help with DictionaryLookup[] and a type of regular expression
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Tue, 11 May 2010 06:29:06 -0400 (EDT)
  • References: <hs67kd$30l$1@smc.vnet.net> <hs8noo$7lh$1@smc.vnet.net>

Am 10.05.2010 12:39, schrieb Albert Retey:
> Am 09.05.2010 13:51, schrieb Michael Stern:
>> Is there an elegant way to do dictionary searches that match specified 
>> kinds of character repetition? For example, to search for six letter 
>> words that start with "d" and end with "k", where the third and fourth 
>> letter are the same?
>>
>> Finding six letter words that start with "d" and end with "k" is easy --
>>
>> DictionaryLookup[{"English", RegularExpression["d....k"]}]
>>
>> But how do we restrict the answer to words where the third and fourth 
>> letters are the same?
> 
> I guess you could do it with a regexp too, but in this case it was
> easier for me to create a StringExpression:
> 
> DictionaryLookup[{"English", _ ~~ _ ~~ x_ ~~ x_ ~~ _ ~~ _}]

I just realized that you wanted the above to be restricted, not an
entirely new lookup. This would do that (I think you did guess already...)

DictionaryLookup[{"English", "d" ~~ _ ~~ x_ ~~ x_ ~~ _ ~~ "k"}]

albert


  • Prev by Date: Interference data in optica
  • Next by Date: Re: How to write reports and books in Mathematica
  • Previous by thread: Re: help with DictionaryLookup[] and a type of regular expression
  • Next by thread: Re: and a type of regular expression