Guess the words using the dictionary

I guess the key is a less simple plain cryptographic ciphertext. The rule that I evaluate the correctness of the key is the number of English words in the intended decryption.

Are there any tools in java that can check the number of english words in a string. For example, "thefoitedstateswasat" → 4 words "thefortedxyzstateswasathat" → 5 words.

I downloaded a list of words and used a HashSet as a dictionary. Since I do not know that interword spaces belong to the text, I cannot check words using a simple dictionary.

Thank.

+3
source share
3 answers

I answered a similar question:

If the word consists of two valid words

Java-esque, -, .

+1

, .

, ?

, , (n-1) , . .

+1

, ?

, :

"quackdogsomethinggodknowswhatwhat"

I would have a recursive method starting at the beginning of the line, I would call a recursive method for all the words that begin the subject line, in this case “qua” and “quack” with a string containing no words (“dogomethinggodknowswhat” for a charlatan) . We return everything that is larger: 1 + the largest value returned from all calls to your method OR 0 + the method call for the line starting at index 1 ("uackdogsomethinggodknowswhat").

This will probably work best if you saved your list of words in some tree.

If you need pseudo code, ask!

0
source

Source: https://habr.com/ru/post/1791132/


All Articles