public class TextGenerator extends Object implements RandomTextProvider
| Constructor and Description |
|---|
TextGenerator(String configPath) |
| Modifier and Type | Method and Description |
|---|---|
String |
generateQueryString(int words,
double approximateFrequency)
Generate a query string that may match in some way against the corpus of generated documents as a whole.
|
String |
generateQueryString(long seed,
int words,
int wordLimit)
Generate a query string that exactly matches the specific random content in some way
|
InputStream |
getInputStream(long seed,
long length,
String... strings)
Generate a repeatable input stream made up of random words.
|
WordGenerator |
getWordGenerator() |
public TextGenerator(String configPath)
public InputStream getInputStream(long seed, long length, String... strings) throws IOException
RandomTextProvidergetInputStream in interface RandomTextProviderseed - - the initial seed for the state of the generator - to give repeatable contentlength - - the length of content required in bytesstrings - - an optional array of strings. The first will be in 100% of streams generated, the next 10%, the next 1% etc.
Null values will be skipped, so you could add a fixed word to 10% and 0.1% of documents using ...., null, "10", null, ".1")IOExceptionpublic String generateQueryString(long seed, int words, int wordLimit)
RandomTextProvidergenerateQueryString in interface RandomTextProviderseed - - the initial seed for the state of the generator - to give repeatable contentwords - - the number of words required in the query stringwordLimit - - the number of words to consider from the generated stream.public String generateQueryString(int words, double approximateFrequency)
RandomTextProvidergenerateQueryString in interface RandomTextProviderwords - - the number of words required in the query stringpublic WordGenerator getWordGenerator()
Copyright © 2015. All rights reserved.