Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum > General > > "DictionaryLookup for a pair of words"

Post Reply:
Name:
Email Address:

Please send email when my message is replied to.

Url (optional):
Subject:
Message: view original message?
Attachment (optional):
Please answer this:6+1 =



Original Message (ID '38955') By Bill Simpson:
In Response To 'Re: Re: Re: DictionaryLookup for a pair of words' --------- Unfortunately I can't test that at the moment here and I did all this by reading the documentation, using a little Mathematica experience and constructing some sample data to test it on. That appeard to work on the test cases that I built in a few minutes. I recommend you use the usual method of diagnosing Mathematica code, take it apart and see what you get. Does this work for you as expected? DictionaryLookup["English", RegularExpression["b......"] If that doesn't work then you have a small problem to focus on and the help pages should point you in the right direction. Does this then build up an idex of pairs, where the first item is a list of characters in order and the second item is the word? bindex = Map[{Union[Rest[Characters[#]]], #} &, DictionaryLookup["English", RegularExpression["b......"]]] Ah... I see a bug in that now. It worked with my little test cases but I realize that will discard duplicate characters and that would generate more and incorrect matches, not less. Union should have been Sort. Sorry. My test cases didn't think to catch that. But, do you correctly get two indexes with the appropriate words in them? Then look at the result of matches = Intersection[Map[First, bindex], Map[First, mindex]] Do you see a list of lists of single character strings which should be the target you are looking for. Then look at the result of Map[{Cases[bindex, {#, _}], Cases[mindex, {#, _}]} &, matches] and see if it is pulling the correct index entries. Since you say it is returning nothing there must be at least one step in this fairly short chain that was working with my hand constructed test data and isn't working with your system. You just need to pinpoint where the error is. Sorry, perhaps I should have let you figure this one out.