i am looking for an algorithm that will generate all possible combinations of words from given dictionary that satisfy given format.
Let me explain what i mean with format:
For example, if the format is "abcd" means that we are looking for one word, length of the word must be 4 and because all the letters in format are different, all the letters in the word must be different.
The format "computer science" means:
1) We are looking for 2 words (one of length len("computer") = 8 and one of lenght len("science") = 7)
2) The first char of the first word must be the same as the second char and the sixth char in the second word (letter "c" in format)
3) The seventh char of the first word must be the same as the the forth and the last char in the second word (letter "e" in format)
Is it better to generate all the possible strings in given format and the look them up in the dictionary or somehow build strings using dictionary ?
edit:
My idea:
1) split big dictionary (100 millions of words) into smaller ones based on word length.
2) for first word get trough all the entries in particular dictionary and try to match first word, then continue with the next one, but with more restrictions.
Thank you for your help!