4 ms·
1. Create a list of common words, the more the better. Let's say we list a common spelling dictionary of 80,000 words. 2. Create an order-5 permutation of the
by lutusp 13y ago
1. Create a list of common words, the more the better. Let's say we list a common spelling dictionary of 80,000 words.
2. Create an order-5 permutation of the list (a result in which the order of the words matters). For an 80,000 word dictionary, that's 3.27 x 10^24 test sentences, each of five words.
3. Scan the result sentence set, using a heuristic able to distinguish valid sentences from invalid ones. Let's say that one optimized validation test requires one millisecond -- in that case, the test would require 1.04 x 10^14 years, 7536 times the age of the universe.
Meaning this is a much easier question to ask than answer.
EDIT: Another approach is to make an arbitrary assumption about the structure of a five-word sentence, like pronoun-noun-noun-verb-noun: "The calico cat ate breakfast.". Crude and limited, and many apparently valid results will be meaningless, but it makes the estimate easier.
We realize that random words have a probability of being pronouns, nouns or verbs, pp, pn and pv. The probability of producing a valid sentence (pvs) using the described template is therefore:
pvs = pp * pn * pn * pv * pn
Just generate the probability values by scanning a dictionary, identifying the word types (easier said than done), perform the above equation, and you have your answer.
- jtmoulia 13y agoComplementing the thought on sentence structures: 5 word sentences could be extracted from existing texts. Tagging them would give you the set of possible sentence structures. Hopefully there wouldn't be too much trouble with ambiguous word types, e.g. green can be either an adj or noun.