|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hibernate.search.test.util.textbuilder.SentenceInventor
public class SentenceInventor
Test utility meant to produce sentences of a randomly generated language, having some properties of natural languages. The goal is to produce sentences which look like a western text, but are not. All sentences from the same SentenceInventor will share a limited dictionary, making the frequencies suitable to test with Lucene. Sentences produced depend from the constructor arguments, making the output predictable for testing purposes.
Constructor Summary | |
---|---|
SentenceInventor(long randomSeed,
int dictionarySize)
|
Method Summary | |
---|---|
static void |
main(String[] args)
|
String |
nextPeriod()
Combines a random (gaussian) number of sentences in a period, using some punctuation symbols and capitalizing first char, terminating with dot and newline. |
String |
nextSentence()
Builds a sentence concatenating terms from the generated dictionary and spaces |
char |
randomCharacter()
|
String |
randomString()
Produces a randomly generated String, using only western alphabet characters and selecting the length as a normal distribution of natural languages. |
String |
randomString(int length)
|
String |
randomTerm()
Produces a random String, which might be lowercase, completely uppercase, or uppercasing the first char (randomly selected) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SentenceInventor(long randomSeed, int dictionarySize)
randomSeed
- the seed to use for random generatordictionarySize
- the number of terms to insert in the dictionary used to build sentencesMethod Detail |
---|
public char randomCharacter()
public String randomString(int length)
length
- the desired length
public String randomString()
public String randomTerm()
public String nextSentence()
public String nextPeriod()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |