Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program needed for change of letters within a string 5

Status
Not open for further replies.

german12

Programmer
Nov 12, 2001
563
DE
Tonight I saw a riddle on television.

They looked for a meaningful german word, however the problem has nothing to do with the language.
They placed the following 9 letters on screen:

B L U T M E O P F

and asked "what meaningful word is hidden here?"

I know that this has to been recognized as a string-change-problem where every letter can have the place from 1 to 9 (no doubles) to cover all possibilities and then it would be easy (for me,not easy for the program) to find out what a meaningful word is.

I thought about a loop to deliver me all possibilities but I
did not come to a solution.

How has that loop to be coded?
And - how many words (senseless or not) will that produce in total in case of this example ?

It is not necessary to compare the words found with an enzyklopedia.

I know that Foxpro can do it with just a few commands (as well as Basic or C++) but in Fox it would be most understandable for me.

Thanks folks.

By the way - they awarded 4,000 Euro for the right word, and
next time when they have a similiar riddle, I would run such
a evaluation-program to be the first who phones *ggg

Peace worldwide - it starts here...
 
Olaf,
(For our english friends I try to translate it partly:)
Here is a source for cheap wordbooks:


(and then as a german search-word: "Wörterbuch")
will lead to:


-----------------------------------------------------------
Grimms German Wordbook on 2 CD-ROM, 49.90 EURO

Jacob und Wilhelm Grimm: Grimms Deutsches Wörterbuch. Auf 2 CD-ROMs. Das "allerwichtigste Buch in deutscher Sprache" (Marcel Reich-Ranicki) endlich in elektronischer Version - der Digitale Grimm. Nur 49,90 EURO
---------------------------------------------------------
Langenscheidt Hand-Wordbook on CD-ROM (German-English,
English/German)
220,000 Search-words and phrases.
Instead of 52 only 17.95 EURO.

Langenscheidts Handwörterbuch Englisch-Deutsch/Deutsch-Englisch. Das Profi-Wörterbuch auf CD-ROM. Arbeit mit und an Texten findet inzwischen fast nur noch am Computer statt. Da liegt es auf der Hand, die Nachschlagewerke auch im Computer zu haben, am besten verknüpft mit der Textverarbeitung. So einfach geht es auch bei Langenscheidts Handwörterbuch Englisch auf CD-ROM. Einfach das Wort in der gerade benutzten eigenen Anwendung (Outlook, Textverarbeitung, Internet-Browser oder andere) markieren, Taste drücken, und schon ist man beim entsprechenden Eintrag im Handwörterbuch gelandet. Rund 220.000 Stichwörter und Wendungen. Mehr Info (mit Treffer "wörterbuch"). Statt e.P. 52,00 EUR nur 17,95 EUR. Nr. 14739.
----------------------------------------------------------
The cheapest German wordbook is this:

Wordbook of the German colloquial Language on CD-ROM
Instead of 34.90 only 9.90 Euro.


Das Wörterbuch der deutschen Umgangssprache. Von Heinz Küpper. Auf CD-ROM statt 34,90 EUR (e.P.) nur 9,90 EUR.
--------------------------------------------------------


The only question is, whether there is access on these databases possible from within VFP.

What do you think?

Regards
Klaus


Peace worldwide - it starts here...
 
Hi Klaus,

I'd say that no procducer of such an electronic dictionary would make it easy for anybody to extract all data (and create another dictionary by that). So you may try one or some of these, but before you don't have it, it would only be guessing, if it's readable for foxpro. Most probably not easily.

If you have MS Word, this has an integrated dictionary. You may be able to read that out and store it in a foxpro table.

oWord = createobject("Word.Application")
for i = 1 to oWord.GetSpellingSuggestions("aa").count
? oWord.GetSpellingSuggestions("aa").Item(i).Name
endfor i

Gives you existing words quite similar to aa. Now you may loop from aa,ab,ac ... xz,yz,zz,aaa,... and then create the dictionary by that. Maybe there is a more native way to read that dictionaries.

Well, and thank's for the star.

Bye, Olaf.
 
Olaf, I tried your prog with Word97 however this error was reported:


"Element GetSpellingSuggestions kann nicht zu einem Objekt ausgewertet werden"

english:
element getspellingsuggestions can not be evaluated to an object.

What is the reason?

I do use VFP 7

Peace worldwide - it starts here...
 
Hi Klaus,

I don't think Office 97 has this function. I have Office 2003 installed. I also observed, that it won't work, if no document is open, so perhaps try:
Code:
oWord = createobject("Word.Application")
oWord.Documents.Add() && add an empty dummy document
for i = 1 to oWord.GetSpellingSuggestions("aa").count
   ? oWord.GetSpellingSuggestions("aa").Item(i).Name
endfor i

I played around a bit with this and it's rather slow. (If bomarbing word with guessed words it consumes 99% cpu time). And it's hard to extract words this way, as you must give a word that's written at least roughly similar to a real world. And if the Count is 0 it doesn't mean the guessed word is a correct one, MS Word also has no suggestions for a word roughly similiar to "asdjkjsdkh" eg.

There must be an easier way to get a decent list of words. Perhaps read in texts with APPEND FROM some.txt TYPE sdf
and then select distinct words from that.

If you have lots of large german word.docs perhaps save them as .txt or loop through oWord.ActiveDocument.Words(n).Text with n from 1 to oWord.ActiveDocument.Words().Count

You may write a programm that uses some decent sources for correctly spelled texts, like and their RSS (XML) Newsfeed and extract word's from there or anywhere on the internet as a background task.

Well, texts are all around you. And you just need the word's, not their syllables or their translations or their meanings or synonyms of them, right? Some false words also don't hurt.

also is a nice start. I extracted about 100,000 words of it (just the german words) and also removed brackets and stuff like {f} {m} {pl} : ! ? , with chrtran() and strtran().

Bye, Olaf.
 
Olaf, the good news: Also Word97 can do it, the only reason that it did not run first, was the missing empty document.

To gain a word-list by several documents is also a practical way but of course you can never be sure having collect all words, however better than nothing indeed.

Tomorrow I will ask via a german forum which is called


There you can place all questions you never got answered - and
I had very often good luck with that - the answers are automatically e-mailed to me.
Have a look at it.

I will keep this forum informed about further experience.

How big is that cleaned word-list which you extracted?
In case it is not too big could you mail it to

Igel2003@gmx.de

(I do use this adress very seldom and just to have one which I can public without any danger of misuse, so give me a note here when that was possible)


Thx for now.

Regards
Klaus



Peace worldwide - it starts here...
 
Hi Klaus,

how long can it be to not overload your gmx account? 1 MB?
Maybe I'll put it on our site as a download...

To be as short as possible, I'd make a TXT file of the data and zip that of course. Then finally it should be shorter than the original download, because it only contains the german words. And that was 2 MB (zipped), so it should come down to 1 MB.

I don't have copied all commands I used to tidy the word list, that would of course be much easier to send.

Well, I tried to get more words from GetSpellingSuggestions, and it seems that Word will give an Extra 10% Words, which would also include several forms of the words, eg singular and plural of the same word.

Until tomorrow.
Bye, Olaf.

 
Hi Klaus,

I've sent you a link to a download (<500 KB) to your GMX account. And some nice or funny anagrams I found through that word base.

Bye, Olaf.
 
Hi Olaf,

many thx for the txt-files which I downloaded.
Very funny anagrams where filtered there by you.

Even triple-anagrams, I was deeply impressed.

Here are the capacities of german Mailboxes (source:
Computerbild 26/2004 dated Dec,13.) they compared 10 mailboxes with all their technical details there:

My mailbox has a max. receiving capacity for one mail of 20 MB. (sending capacity is also 20 MB).
If you are interested in what all the other Mailboxes are
capable I could send you a screenshot.

They compared different versions of Freemail, GMX,Freenet, Lycos and Yahoo!.

My mailbox is free of charge.

I will mail you later on.

Bye
Klaus



Peace worldwide - it starts here...
 
The last time I used such a mailbox the limits where about 1 MB or less.

Well, now I work on an algorithm to find anagram sentences. I'll limit that to finding a word list that fits to a given sentence and leave it to the user to build sentences of them. The problem is, that the comparison of the sorted letters as footprints of the words and the sentence is of course insufficient.

The general algorithm is a recursive one, where you search a word that can be built from some or all of the letters of the sentence and if you found such a word repeat with the rest of the letters until there are no more left.

To make this search for appropriate words faster and to limit testing to words likely to be possible, I'd index words on included letters and length and would begin with searching words, that have the most seldom used letter of the sentence included in them and are short enough to be built by the letters of the sentence (or the rest of it in deeper levels of the recursive search) and begin with the longest of those words to reduce the letters of the sentence fastest.

It's a nice computational problem...

Bye, Olaf.
 
Olaf, I am glad having caused so much fun with my question to
you.
If it is not enough word-playing pls also have a look at


so that your evenings will not become boring. *ggg

I look forward to your success.

Regards
Klaus



Peace worldwide - it starts here...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top