Generates random strings of "lorem ipsum" text, based on the word distribution of a sample text, using the words in a dictionary.
Instance Method Summary | |
chooseRandomStart_() ⇒ ?Array Picks a random starting chain. | |
generateChains_(string sample) Generates the chains and starts values required for sentence generation. | |
generateParagraph(boolean opt_startWithLorem) ⇒ string Generates a single lorem ipsum paragraph, of random length. | |
generateParagraphStatistics_(string sample) Calculates the mean and standard deviation of the lengths of paragraphs (in sentences) in a sample text. | |
generateSentence(boolean opt_startWithLorem) ⇒ string Generates a single sentence, of random length. | |
generateSentenceStatistics_(string sample) Calculates the mean and standard deviation of the lengths of sentences (in words) in a sample text. | |
generateStatistics_(string sample) Calculates the mean and standard deviation of sentence and paragraph lengths. | |
initializeDictionary_(string dictionary) Sets the generator to use a given selection of words for generating sentences with. |
Static Method Summary | |
arrayLength_(?Array array) ⇒ number Returns the length of an array. Written as a function so it can be used as a function parameter. | |
chooseClosest(?Array values, number target) ⇒ number Find the number in the list of values that is closest to the target. | |
getWordInfo_(string word) ⇒ ?Array Gets info about a word used as part of the lorem ipsum algorithm. | |
isNotEmptyOrWhitepace_(string text) ⇒ boolean Returns the text is not empty or just whitespace. | |
randomChoice_(?Array array) ⇒ <Any Type> Picks a random element of the array. | |
randomNormal_(number mu, number sigma) Generates a random number for a normal distribution with the specified mean and sigma. | |
splitParagraphs_(string text) ⇒ ?Array Splits a piece of text into paragraphs. | |
splitSentences_(string text) ⇒ ?Array Splits a piece of text into sentences. | |
splitWords_(string text) ⇒ ?Array Splits a piece of text into words.. |