| 1 |
// Copyright 2009 The Closure Library Authors. All Rights Reserved. |
| 2 |
|
| 3 |
/** |
| 4 |
* @fileoverview A generator of lorem ipsum text based on the python |
| 5 |
* implementation at http://code.google.com/p/lorem-ipsum-generator/. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
goog.provide('goog.text.LoremIpsum'); |
| 10 |
|
| 11 |
goog.require('goog.array'); |
| 12 |
goog.require('goog.math'); |
| 13 |
goog.require('goog.string'); |
| 14 |
goog.require('goog.structs.Map'); |
| 15 |
goog.require('goog.structs.Set'); |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
/** |
| 20 |
* Generates random strings of "lorem ipsum" text, based on the word |
| 21 |
* distribution of a sample text, using the words in a dictionary. |
| 22 |
* @constructor |
| 23 |
*/ |
| 24 |
goog.text.LoremIpsum = function() { |
| 25 |
this.generateChains_(this.sample_); |
| 26 |
this.generateStatistics_(this.sample_); |
| 27 |
|
| 28 |
this.initializeDictionary_(this.dictionary_); |
| 29 |
}; |
| 30 |
|
| 31 |
|
| 32 |
/** |
| 33 |
* Delimiters that end sentences. |
| 34 |
* @type {Array<string>} |
| 35 |
* @private |
| 36 |
*/ |
| 37 |
goog.text.LoremIpsum.DELIMITERS_SENTENCES_ = ['.', '?', '!']; |
| 38 |
|
| 39 |
|
| 40 |
/** |
| 41 |
* Regular expression for spliting a text into sentences. |
| 42 |
* @type {RegExp} |
| 43 |
* @private |
| 44 |
*/ |
| 45 |
goog.text.LoremIpsum.SENTENCE_SPLIT_REGEX_ = /[\.\?\!]/; |
| 46 |
|
| 47 |
|
| 48 |
/** |
| 49 |
* Delimiters that end words. |
| 50 |
* @type {Array<string>} |
| 51 |
* @private |
| 52 |
*/ |
| 53 |
goog.text.LoremIpsum.DELIMITERS_WORDS_ = [',', '.', '?', '!']; |
| 54 |
|
| 55 |
|
| 56 |
/** |
| 57 |
* Regular expression for spliting text into words. |
| 58 |
* @type {RegExp} |
| 59 |
* @private |
| 60 |
*/ |
| 61 |
goog.text.LoremIpsum.WORD_SPLIT_REGEX_ = /\s/; |
| 62 |
|
| 63 |
|
| 64 |
/** |
| 65 |
* Words that can be used in the generated output. |
| 66 |
* Maps a word-length to a list of words of that length. |
| 67 |
* @type {goog.structs.Map} |
| 68 |
* @private |
| 69 |
*/ |
| 70 |
goog.text.LoremIpsum.prototype.words_; |
| 71 |
|
| 72 |
|
| 73 |
/** |
| 74 |
* Chains of three words that appear in the sample text |
| 75 |
* Maps a pair of word-lengths to a third word-length and an optional |
| 76 |
* piece of trailing punctuation (for example, a period, comma, etc.). |
| 77 |
* @type {goog.structs.Map} |
| 78 |
* @private |
| 79 |
*/ |
| 80 |
goog.text.LoremIpsum.prototype.chains_; |
| 81 |
|
| 82 |
|
| 83 |
/** @private {!Object<string, !Array>} */ |
| 84 |
goog.text.LoremIpsum.prototype.chainKeys_; |
| 85 |
|
| 86 |
|
| 87 |
/** |
| 88 |
* Pairs of word-lengths that can appear at the beginning of sentences. |
| 89 |
* @type {Array} |
| 90 |
*/ |
| 91 |
goog.text.LoremIpsum.prototype.starts_; |
| 92 |
|
| 93 |
|
| 94 |
/** |
| 95 |
* Averange sentence length in words. |
| 96 |
* @type {number} |
| 97 |
* @private |
| 98 |
*/ |
| 99 |
goog.text.LoremIpsum.prototype.sentenceMean_; |
| 100 |
|
| 101 |
|
| 102 |
/** |
| 103 |
* Sigma (sqrt of variance) for the sentence length in words. |
| 104 |
* @type {number} |
| 105 |
* @private |
| 106 |
*/ |
| 107 |
goog.text.LoremIpsum.prototype.sentenceSigma_; |
| 108 |
|
| 109 |
|
| 110 |
/** |
| 111 |
* Averange paragraph length in sentences. |
| 112 |
* @type {number} |
| 113 |
* @private |
| 114 |
*/ |
| 115 |
goog.text.LoremIpsum.prototype.paragraphMean_; |
| 116 |
|
| 117 |
|
| 118 |
/** |
| 119 |
* Sigma (sqrt of variance) for the paragraph length in sentences. |
| 120 |
* @type {number} |
| 121 |
* @private |
| 122 |
*/ |
| 123 |
goog.text.LoremIpsum.prototype.paragraphSigma_; |
| 124 |
|
| 125 |
|
| 126 |
/** |
| 127 |
* Generates the chains and starts values required for sentence generation. |
| 128 |
* @param {string} sample The same text. |
| 129 |
* @private |
| 130 |
*/ |
| 131 |
goog.text.LoremIpsum.prototype.generateChains_ = function(sample) { |
| 132 |
var words = goog.text.LoremIpsum.splitWords_(sample); |
| 133 |
var wordInfo = goog.array.map(words, goog.text.LoremIpsum.getWordInfo_); |
| 134 |
|
| 135 |
/** @type {!Array<number>} */ |
| 136 |
var previous = [0, 0]; |
| 137 |
var previousKey = previous.join('-'); |
| 138 |
var chains = new goog.structs.Map(); |
| 139 |
var starts = [previousKey]; |
| 140 |
var chainKeys = {}; |
| 141 |
|
| 142 |
goog.array.forEach(wordInfo, function(pair) { |
| 143 |
var chain = chains.get(previousKey); |
| 144 |
if (chain) { |
| 145 |
chain.push(pair); |
| 146 |
} else { |
| 147 |
chain = [pair]; |
| 148 |
chains.set(previousKey, chain); |
| 149 |
} |
| 150 |
|
| 151 |
if (goog.array.contains( |
| 152 |
goog.text.LoremIpsum.DELIMITERS_SENTENCES_, pair[1])) { |
| 153 |
starts.push(previousKey); |
| 154 |
} |
| 155 |
chainKeys[previousKey] = previous; |
| 156 |
previous = [previous[1], pair[0]]; |
| 157 |
previousKey = previous.join('-'); |
| 158 |
}); |
| 159 |
|
| 160 |
if (chains.getCount() > 0) { |
| 161 |
this.chains_ = chains; |
| 162 |
this.starts_ = starts; |
| 163 |
this.chainKeys_ = chainKeys; |
| 164 |
} else { |
| 165 |
throw Error('Could not generate chains from sample text.'); |
| 166 |
} |
| 167 |
}; |
| 168 |
|
| 169 |
|
| 170 |
/** |
| 171 |
* Calculates the mean and standard deviation of sentence and paragraph lengths. |
| 172 |
* @param {string} sample The same text. |
| 173 |
* @private |
| 174 |
*/ |
| 175 |
goog.text.LoremIpsum.prototype.generateStatistics_ = function(sample) { |
| 176 |
this.generateSentenceStatistics_(sample); |
| 177 |
this.generateParagraphStatistics_(sample); |
| 178 |
}; |
| 179 |
|
| 180 |
|
| 181 |
/** |
| 182 |
* Calculates the mean and standard deviation of the lengths of sentences |
| 183 |
* (in words) in a sample text. |
| 184 |
* @param {string} sample The same text. |
| 185 |
* @private |
| 186 |
*/ |
| 187 |
goog.text.LoremIpsum.prototype.generateSentenceStatistics_ = function(sample) { |
| 188 |
var sentences = goog.array.filter( |
| 189 |
goog.text.LoremIpsum.splitSentences_(sample), |
| 190 |
goog.text.LoremIpsum.isNotEmptyOrWhitepace_); |
| 191 |
|
| 192 |
var sentenceLengths = goog.array.map( |
| 193 |
goog.array.map(sentences, goog.text.LoremIpsum.splitWords_), |
| 194 |
goog.text.LoremIpsum.arrayLength_); |
| 195 |
this.sentenceMean_ = goog.math.average.apply(null, sentenceLengths); |
| 196 |
this.sentenceSigma_ = goog.math.standardDeviation.apply( |
| 197 |
null, sentenceLengths); |
| 198 |
}; |
| 199 |
|
| 200 |
|
| 201 |
/** |
| 202 |
* Calculates the mean and standard deviation of the lengths of paragraphs |
| 203 |
* (in sentences) in a sample text. |
| 204 |
* @param {string} sample The same text. |
| 205 |
* @private |
| 206 |
*/ |
| 207 |
goog.text.LoremIpsum.prototype.generateParagraphStatistics_ = function(sample) { |
| 208 |
var paragraphs = goog.array.filter( |
| 209 |
goog.text.LoremIpsum.splitParagraphs_(sample), |
| 210 |
goog.text.LoremIpsum.isNotEmptyOrWhitepace_); |
| 211 |
|
| 212 |
var paragraphLengths = goog.array.map( |
| 213 |
goog.array.map(paragraphs, goog.text.LoremIpsum.splitSentences_), |
| 214 |
goog.text.LoremIpsum.arrayLength_); |
| 215 |
|
| 216 |
this.paragraphMean_ = goog.math.average.apply(null, paragraphLengths); |
| 217 |
this.paragraphSigma_ = goog.math.standardDeviation.apply( |
| 218 |
null, paragraphLengths); |
| 219 |
}; |
| 220 |
|
| 221 |
|
| 222 |
/** |
| 223 |
* Sets the generator to use a given selection of words for generating |
| 224 |
* sentences with. |
| 225 |
* @param {string} dictionary The dictionary to use. |
| 226 |
* @private |
| 227 |
*/ |
| 228 |
goog.text.LoremIpsum.prototype.initializeDictionary_ = function(dictionary) { |
| 229 |
var dictionaryWords = goog.text.LoremIpsum.splitWords_(dictionary); |
| 230 |
|
| 231 |
var words = new goog.structs.Map(); |
| 232 |
goog.array.forEach(dictionaryWords, function(word) { |
| 233 |
var set = words.get(word.length); |
| 234 |
if (!set) { |
| 235 |
set = new goog.structs.Set(); |
| 236 |
words.set(word.length, set); |
| 237 |
} |
| 238 |
set.add(word); |
| 239 |
}); |
| 240 |
|
| 241 |
this.words_ = words; |
| 242 |
}; |
| 243 |
|
| 244 |
|
| 245 |
/** |
| 246 |
* Picks a random starting chain. |
| 247 |
* @return {Array<string>} The starting key. |
| 248 |
* @private |
| 249 |
*/ |
| 250 |
goog.text.LoremIpsum.prototype.chooseRandomStart_ = function() { |
| 251 |
var key = /** @type {string} */ (goog.text.LoremIpsum.randomChoice_( |
| 252 |
this.starts_)); |
| 253 |
return this.chainKeys_[key]; |
| 254 |
}; |
| 255 |
|
| 256 |
|
| 257 |
/** |
| 258 |
* Generates a single sentence, of random length. |
| 259 |
* @param {boolean=} opt_startWithLorem Whether to start the setnence with the |
| 260 |
* standard "Lorem ipsum..." first sentence. |
| 261 |
* @return {string} The generated sentence. |
| 262 |
*/ |
| 263 |
goog.text.LoremIpsum.prototype.generateSentence = function(opt_startWithLorem) { |
| 264 |
if (this.chains_.getCount() == 0 || this.starts_.length == 0) { |
| 265 |
throw Error('No chains created'); |
| 266 |
} |
| 267 |
|
| 268 |
if (this.words_.getCount() == 0) { |
| 269 |
throw Error('No dictionary'); |
| 270 |
} |
| 271 |
|
| 272 |
// The length of the sentence is a normally distributed random variable. |
| 273 |
var sentenceLength = goog.text.LoremIpsum.randomNormal_( |
| 274 |
this.sentenceMean_, this.sentenceSigma_); |
| 275 |
sentenceLength = Math.max(Math.floor(sentenceLength), 1); |
| 276 |
|
| 277 |
var wordDelimiter = ''; // Defined here in case while loop doesn't run |
| 278 |
|
| 279 |
// Start the sentence with "Lorem ipsum...", if desired |
| 280 |
var sentence; |
| 281 |
if (opt_startWithLorem) { |
| 282 |
var lorem = 'lorem ipsum dolor sit amet, consecteteur adipiscing elit'; |
| 283 |
sentence = goog.text.LoremIpsum.splitWords_(lorem); |
| 284 |
if (sentence.length > sentenceLength) { |
| 285 |
sentence.length = sentenceLength; |
| 286 |
} |
| 287 |
var lastWord = sentence[sentence.length - 1]; |
| 288 |
var lastChar = lastWord.substring(lastWord.length - 1); |
| 289 |
if (goog.array.contains(goog.text.LoremIpsum.DELIMITERS_WORDS_, lastChar)) { |
| 290 |
wordDelimiter = lastChar; |
| 291 |
} |
| 292 |
} else { |
| 293 |
sentence = []; |
| 294 |
} |
| 295 |
|
| 296 |
var previous = []; |
| 297 |
var previousKey = ''; |
| 298 |
// Generate a sentence from the "chains" |
| 299 |
while (sentence.length < sentenceLength) { |
| 300 |
// If the current starting point is invalid, choose another randomly |
| 301 |
if (!this.chains_.containsKey(previousKey)) { |
| 302 |
previous = this.chooseRandomStart_(); |
| 303 |
previousKey = previous.join('-'); |
| 304 |
} |
| 305 |
|
| 306 |
// Choose the next "chain" to go to. This determines the next word |
| 307 |
// length we'll use, and whether there is e.g. a comma at the end of |
| 308 |
// the word. |
| 309 |
var chain = /** @type {Array} */ (goog.text.LoremIpsum.randomChoice_( |
| 310 |
/** @type {Array} */ (this.chains_.get(previousKey)))); |
| 311 |
var wordLength = chain[0]; |
| 312 |
|
| 313 |
// If the word delimiter contained in the chain is also a sentence |
| 314 |
// delimiter, then we don't include it because we don't want the |
| 315 |
// sentence to end prematurely (we want the length to match the |
| 316 |
// sentence_length value). |
| 317 |
//debugger; |
| 318 |
if (goog.array.contains(goog.text.LoremIpsum.DELIMITERS_SENTENCES_, |
| 319 |
chain[1])) { |
| 320 |
wordDelimiter = ''; |
| 321 |
} else { |
| 322 |
wordDelimiter = chain[1]; |
| 323 |
} |
| 324 |
|
| 325 |
// Choose a word randomly that matches (or closely matches) the |
| 326 |
// length we're after. |
| 327 |
var closestLength = goog.text.LoremIpsum.chooseClosest( |
| 328 |
this.words_.getKeys(), wordLength); |
| 329 |
var word = goog.text.LoremIpsum.randomChoice_( |
| 330 |
this.words_.get(closestLength).getValues()); |
| 331 |
|
| 332 |
sentence.push(word + wordDelimiter); |
| 333 |
previous = [previous[1], wordLength]; |
| 334 |
previousKey = previous.join('-'); |
| 335 |
} |
| 336 |
|
| 337 |
// Finish the sentence off with capitalisation, a period and |
| 338 |
// form it into a string |
| 339 |
sentence = sentence.join(' '); |
| 340 |
sentence = sentence.slice(0, 1).toUpperCase() + sentence.slice(1); |
| 341 |
if (sentence.substring(sentence.length - 1) == wordDelimiter) { |
| 342 |
sentence = sentence.slice(0, sentence.length - 1); |
| 343 |
} |
| 344 |
return sentence + '.'; |
| 345 |
}; |
| 346 |
|
| 347 |
|
| 348 |
/** |
| 349 |
* Generates a single lorem ipsum paragraph, of random length. |
| 350 |
* @param {boolean=} opt_startWithLorem Whether to start the sentence with the |
| 351 |
* standard "Lorem ipsum..." first sentence. |
| 352 |
* @return {string} The generated sentence. |
| 353 |
*/ |
| 354 |
goog.text.LoremIpsum.prototype.generateParagraph = function( |
| 355 |
opt_startWithLorem) { |
| 356 |
// The length of the paragraph is a normally distributed random variable. |
| 357 |
var paragraphLength = goog.text.LoremIpsum.randomNormal_( |
| 358 |
this.paragraphMean_, this.paragraphSigma_); |
| 359 |
paragraphLength = Math.max(Math.floor(paragraphLength), 1); |
| 360 |
|
| 361 |
// Construct a paragraph from a number of sentences. |
| 362 |
var paragraph = []; |
| 363 |
var startWithLorem = opt_startWithLorem; |
| 364 |
while (paragraph.length < paragraphLength) { |
| 365 |
var sentence = this.generateSentence(startWithLorem); |
| 366 |
paragraph.push(sentence); |
| 367 |
startWithLorem = false; |
| 368 |
} |
| 369 |
|
| 370 |
// Form the paragraph into a string. |
| 371 |
paragraph = paragraph.join(' '); |
| 372 |
return paragraph; |
| 373 |
}; |
| 374 |
|
| 375 |
|
| 376 |
/** |
| 377 |
* Splits a piece of text into paragraphs. |
| 378 |
* @param {string} text The text to split. |
| 379 |
* @return {Array<string>} An array of paragraphs. |
| 380 |
* @private |
| 381 |
*/ |
| 382 |
goog.text.LoremIpsum.splitParagraphs_ = function(text) { |
| 383 |
return text.split('\n'); |
| 384 |
}; |
| 385 |
|
| 386 |
|
| 387 |
/** |
| 388 |
* Splits a piece of text into sentences. |
| 389 |
* @param {string} text The text to split. |
| 390 |
* @return {Array<string>} An array of sentences. |
| 391 |
* @private |
| 392 |
*/ |
| 393 |
goog.text.LoremIpsum.splitSentences_ = function(text) { |
| 394 |
return goog.array.filter( |
| 395 |
text.split(goog.text.LoremIpsum.SENTENCE_SPLIT_REGEX_), |
| 396 |
goog.text.LoremIpsum.isNotEmptyOrWhitepace_); |
| 397 |
}; |
| 398 |
|
| 399 |
|
| 400 |
/** |
| 401 |
* Splits a piece of text into words.. |
| 402 |
* @param {string} text The text to split. |
| 403 |
* @return {Array<string>} An array of words. |
| 404 |
* @private |
| 405 |
*/ |
| 406 |
goog.text.LoremIpsum.splitWords_ = function(text) { |
| 407 |
return goog.array.filter( |
| 408 |
text.split(goog.text.LoremIpsum.WORD_SPLIT_REGEX_), |
| 409 |
goog.text.LoremIpsum.isNotEmptyOrWhitepace_); |
| 410 |
}; |
| 411 |
|
| 412 |
|
| 413 |
/** |
| 414 |
* Returns the text is not empty or just whitespace. |
| 415 |
* @param {string} text The text to check. |
| 416 |
* @return {boolean} Whether the text is nether empty nor whitespace. |
| 417 |
* @private |
| 418 |
*/ |
| 419 |
goog.text.LoremIpsum.isNotEmptyOrWhitepace_ = function(text) { |
| 420 |
return goog.string.trim(text).length > 0; |
| 421 |
}; |
| 422 |
|
| 423 |
|
| 424 |
/** |
| 425 |
* Returns the length of an array. Written as a function so it can be used |
| 426 |
* as a function parameter. |
| 427 |
* @param {Array} array The array to check. |
| 428 |
* @return {number} The length of the array. |
| 429 |
* @private |
| 430 |
*/ |
| 431 |
goog.text.LoremIpsum.arrayLength_ = function(array) { |
| 432 |
return array.length; |
| 433 |
}; |
| 434 |
|
| 435 |
|
| 436 |
/** |
| 437 |
* Find the number in the list of values that is closest to the target. |
| 438 |
* @param {Array<number>|Array<string>} values The values. |
| 439 |
* @param {number} target The target value. |
| 440 |
* @return {number} The closest value. |
| 441 |
*/ |
| 442 |
goog.text.LoremIpsum.chooseClosest = function(values, target) { |
| 443 |
var closest = Number(values[0]); |
| 444 |
goog.array.forEach(values, function(value) { |
| 445 |
if (Math.abs(target - Number(value)) < Math.abs(target - closest)) { |
| 446 |
closest = value; |
| 447 |
} |
| 448 |
}); |
| 449 |
|
| 450 |
return closest; |
| 451 |
}; |
| 452 |
|
| 453 |
|
| 454 |
/** |
| 455 |
* Gets info about a word used as part of the lorem ipsum algorithm. |
| 456 |
* @param {string} word The word to check. |
| 457 |
* @return {Array} A two element array. The first element is the size of the |
| 458 |
* word. The second element is the delimter used in the word. |
| 459 |
* @private |
| 460 |
*/ |
| 461 |
goog.text.LoremIpsum.getWordInfo_ = function(word) { |
| 462 |
var ret; |
| 463 |
goog.array.some(goog.text.LoremIpsum.DELIMITERS_WORDS_, |
| 464 |
function(delimiter) { |
| 465 |
if (goog.string.endsWith(word, delimiter)) { |
| 466 |
ret = [word.length - delimiter.length, delimiter]; |
| 467 |
return true; |
| 468 |
} |
| 469 |
return false; |
| 470 |
} |
| 471 |
); |
| 472 |
return ret || [word.length, '']; |
| 473 |
}; |
| 474 |
|
| 475 |
|
| 476 |
/** |
| 477 |
* Constant used for {@link #randomNormal_}. |
| 478 |
* @type {number} |
| 479 |
* @private |
| 480 |
*/ |
| 481 |
goog.text.LoremIpsum.NV_MAGICCONST_ = 4 * Math.exp(-0.5) / Math.sqrt(2.0); |
| 482 |
|
| 483 |
|
| 484 |
/** |
| 485 |
* Generates a random number for a normal distribution with the specified |
| 486 |
* mean and sigma. |
| 487 |
* @param {number} mu The mean of the distribution. |
| 488 |
* @param {number} sigma The sigma of the distribution. |
| 489 |
* @return {number} |
| 490 |
* @private |
| 491 |
*/ |
| 492 |
goog.text.LoremIpsum.randomNormal_ = function(mu, sigma) { |
| 493 |
while (true) { |
| 494 |
var u1 = Math.random(); |
| 495 |
var u2 = 1.0 - Math.random(); |
| 496 |
var z = goog.text.LoremIpsum.NV_MAGICCONST_ * (u1 - 0.5) / u2; |
| 497 |
var zz = z * z / 4.0; |
| 498 |
if (zz <= -Math.log(u2)) { |
| 499 |
break; |
| 500 |
} |
| 501 |
} |
| 502 |
return mu + z * sigma; |
| 503 |
}; |
| 504 |
|
| 505 |
|
| 506 |
/** |
| 507 |
* Picks a random element of the array. |
| 508 |
* @param {Array} array The array to pick from. |
| 509 |
* @return {*} An element from the array. |
| 510 |
* @private |
| 511 |
*/ |
| 512 |
goog.text.LoremIpsum.randomChoice_ = function(array) { |
| 513 |
return array[goog.math.randomInt(array.length)]; |
| 514 |
}; |
| 515 |
|
| 516 |
|
| 517 |
/** |
| 518 |
* Dictionary of words for lorem ipsum. |
| 519 |
* @private {string} |
| 520 |
*/ |
| 521 |
goog.text.LoremIpsum.DICT_ = |
| 522 |
'a ac accumsan ad adipiscing aenean aliquam aliquet amet ante ' + |
| 523 |
'aptent arcu at auctor augue bibendum blandit class commodo ' + |
| 524 |
'condimentum congue consectetuer consequat conubia convallis cras ' + |
| 525 |
'cubilia cum curabitur curae cursus dapibus diam dictum dictumst ' + |
| 526 |
'dignissim dis dolor donec dui duis egestas eget eleifend elementum ' + |
| 527 |
'elit eni enim erat eros est et etiam eu euismod facilisi facilisis ' + |
| 528 |
'fames faucibus felis fermentum feugiat fringilla fusce gravida ' + |
| 529 |
'habitant habitasse hac hendrerit hymenaeos iaculis id imperdiet ' + |
| 530 |
'in inceptos integer interdum ipsum justo lacinia lacus laoreet ' + |
| 531 |
'lectus leo libero ligula litora lobortis lorem luctus maecenas ' + |
| 532 |
'magna magnis malesuada massa mattis mauris metus mi molestie ' + |
| 533 |
'mollis montes morbi mus nam nascetur natoque nec neque netus ' + |
| 534 |
'nibh nisi nisl non nonummy nostra nulla nullam nunc odio orci ' + |
| 535 |
'ornare parturient pede pellentesque penatibus per pharetra ' + |
| 536 |
'phasellus placerat platea porta porttitor posuere potenti praesent ' + |
| 537 |
'pretium primis proin pulvinar purus quam quis quisque rhoncus ' + |
| 538 |
'ridiculus risus rutrum sagittis sapien scelerisque sed sem semper ' + |
| 539 |
'senectus sit sociis sociosqu sodales sollicitudin suscipit ' + |
| 540 |
'suspendisse taciti tellus tempor tempus tincidunt torquent tortor ' + |
| 541 |
'tristique turpis ullamcorper ultrices ultricies urna ut varius ve ' + |
| 542 |
'vehicula vel velit venenatis vestibulum vitae vivamus viverra ' + |
| 543 |
'volutpat vulputate'; |
| 544 |
|
| 545 |
|
| 546 |
/** |
| 547 |
* A sample to use for generating the distribution of word and sentence lengths |
| 548 |
* in lorem ipsum. |
| 549 |
* @type {string} |
| 550 |
* @private |
| 551 |
*/ |
| 552 |
goog.text.LoremIpsum.SAMPLE_ = |
| 553 |
'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean ' + |
| 554 |
'commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus ' + |
| 555 |
'et magnis dis parturient montes, nascetur ridiculus mus. Donec quam ' + |
| 556 |
'felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla ' + |
| 557 |
'consequat massa quis enim. Donec pede justo, fringilla vel, aliquet ' + |
| 558 |
'nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, ' + |
| 559 |
'venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. ' + |
| 560 |
'Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean ' + |
| 561 |
'vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat ' + |
| 562 |
'vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra ' + |
| 563 |
'quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius ' + |
| 564 |
'laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel ' + |
| 565 |
'augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.\n\n' + |
| 566 |
|
| 567 |
'Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem ' + |
| 568 |
'quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam ' + |
| 569 |
'nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec ' + |
| 570 |
'odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis ' + |
| 571 |
'faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus ' + |
| 572 |
'tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales ' + |
| 573 |
'sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit ' + |
| 574 |
'cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend ' + |
| 575 |
'sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, ' + |
| 576 |
'metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis ' + |
| 577 |
'hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci ' + |
| 578 |
'luctus et ultrices posuere cubilia Curae; In ac dui quis mi ' + |
| 579 |
'consectetuer lacinia.\n\n' + |
| 580 |
|
| 581 |
'Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet ' + |
| 582 |
'nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ' + |
| 583 |
'ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent ' + |
| 584 |
'adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy ' + |
| 585 |
'metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros ' + |
| 586 |
'et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, ' + |
| 587 |
'nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit ' + |
| 588 |
'risus. Phasellus nec sem in justo pellentesque facilisis. Etiam ' + |
| 589 |
'imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus ' + |
| 590 |
'non, auctor et, hendrerit quis, nisi.\n\n' + |
| 591 |
|
| 592 |
'Curabitur ligula sapien, tincidunt non, euismod vitae, posuere ' + |
| 593 |
'imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed ' + |
| 594 |
'cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus ' + |
| 595 |
'accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci ' + |
| 596 |
'luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis ' + |
| 597 |
'porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis ' + |
| 598 |
'orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, ' + |
| 599 |
'bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede ' + |
| 600 |
'sit amet augue. In turpis. Pellentesque posuere. Praesent turpis.\n\n' + |
| 601 |
|
| 602 |
'Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu ' + |
| 603 |
'sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales ' + |
| 604 |
'nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse ' + |
| 605 |
'pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, ' + |
| 606 |
'nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in ' + |
| 607 |
'faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id ' + |
| 608 |
'purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum ' + |
| 609 |
'mollis diam. Pellentesque ut neque. Pellentesque habitant morbi ' + |
| 610 |
'tristique senectus et netus et malesuada fames ac turpis egestas.\n\n' + |
| 611 |
|
| 612 |
'In dui magna, posuere eget, vestibulum et, tempor auctor, justo. In ac ' + |
| 613 |
'felis quis tortor malesuada pretium. Pellentesque auctor neque nec ' + |
| 614 |
'urna. Proin sapien ipsum, porta a, auctor quis, euismod ut, mi. Aenean ' + |
| 615 |
'viverra rhoncus pede. Pellentesque habitant morbi tristique senectus et ' + |
| 616 |
'netus et malesuada fames ac turpis egestas. Ut non enim eleifend felis ' + |
| 617 |
'pretium feugiat. Vivamus quis mi. Phasellus a est. Phasellus magna.\n\n' + |
| 618 |
|
| 619 |
'In hac habitasse platea dictumst. Curabitur at lacus ac velit ornare ' + |
| 620 |
'lobortis. Curabitur a felis in nunc fringilla tristique. Morbi mattis ' + |
| 621 |
'ullamcorper velit. Phasellus gravida semper nisi. Nullam vel sem. ' + |
| 622 |
'Pellentesque libero tortor, tincidunt et, tincidunt eget, semper nec, ' + |
| 623 |
'quam. Sed hendrerit. Morbi ac felis. Nunc egestas, augue at ' + |
| 624 |
'pellentesque laoreet, felis eros vehicula leo, at malesuada velit leo ' + |
| 625 |
'quis pede. Donec interdum, metus et hendrerit aliquet, dolor diam ' + |
| 626 |
'sagittis ligula, eget egestas libero turpis vel mi. Nunc nulla. Fusce ' + |
| 627 |
'risus nisl, viverra et, tempor et, pretium in, sapien. Donec venenatis ' + |
| 628 |
'vulputate lorem.\n\n' + |
| 629 |
|
| 630 |
'Morbi nec metus. Phasellus blandit leo ut odio. Maecenas ullamcorper, ' + |
| 631 |
'dui et placerat feugiat, eros pede varius nisi, condimentum viverra ' + |
| 632 |
'felis nunc et lorem. Sed magna purus, fermentum eu, tincidunt eu, ' + |
| 633 |
'varius ut, felis. In auctor lobortis lacus. Quisque libero metus, ' + |
| 634 |
'condimentum nec, tempor a, commodo mollis, magna. Vestibulum ' + |
| 635 |
'ullamcorper mauris at ligula. Fusce fermentum. Nullam cursus lacinia ' + |
| 636 |
'erat. Praesent blandit laoreet nibh.\n\n' + |
| 637 |
|
| 638 |
'Fusce convallis metus id felis luctus adipiscing. Pellentesque egestas, ' + |
| 639 |
'neque sit amet convallis pulvinar, justo nulla eleifend augue, ac ' + |
| 640 |
'auctor orci leo non est. Quisque id mi. Ut tincidunt tincidunt erat. ' + |
| 641 |
'Etiam feugiat lorem non metus. Vestibulum dapibus nunc ac augue. ' + |
| 642 |
'Curabitur vestibulum aliquam leo. Praesent egestas neque eu enim. In ' + |
| 643 |
'hac habitasse platea dictumst. Fusce a quam. Etiam ut purus mattis ' + |
| 644 |
'mauris sodales aliquam. Curabitur nisi. Quisque malesuada placerat ' + |
| 645 |
'nisl. Nam ipsum risus, rutrum vitae, vestibulum eu, molestie vel, ' + |
| 646 |
'lacus.\n\n' + |
| 647 |
|
| 648 |
'Sed augue ipsum, egestas nec, vestibulum et, malesuada adipiscing, ' + |
| 649 |
'dui. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi ' + |
| 650 |
'congue nunc, vitae euismod ligula urna in dolor. Mauris sollicitudin ' + |
| 651 |
'fermentum libero. Praesent nonummy mi in odio. Nunc interdum lacus sit ' + |
| 652 |
'amet orci. Vestibulum rutrum, mi nec elementum vehicula, eros quam ' + |
| 653 |
'gravida nisl, id fringilla neque ante vel mi. Morbi mollis tellus ac ' + |
| 654 |
'sapien. Phasellus volutpat, metus eget egestas mollis, lacus lacus ' + |
| 655 |
'blandit dui, id egestas quam mauris ut lacus. Fusce vel dui. Sed in ' + |
| 656 |
'libero ut nibh placerat accumsan. Proin faucibus arcu quis ante. In ' + |
| 657 |
'consectetuer turpis ut velit. Nulla sit amet est. Praesent metus ' + |
| 658 |
'tellus, elementum eu, semper a, adipiscing nec, purus. Cras risus ' + |
| 659 |
'ipsum, faucibus ut, ullamcorper id, varius ac, leo. Suspendisse ' + |
| 660 |
'feugiat. Suspendisse enim turpis, dictum sed, iaculis a, condimentum ' + |
| 661 |
'nec, nisi. Praesent nec nisl a purus blandit viverra. Praesent ac ' + |
| 662 |
'massa at ligula laoreet iaculis. Nulla neque dolor, sagittis eget, ' + |
| 663 |
'iaculis quis, molestie non, velit.\n\n' + |
| 664 |
|
| 665 |
'Mauris turpis nunc, blandit et, volutpat molestie, porta ut, ligula. ' + |
| 666 |
'Fusce pharetra convallis urna. Quisque ut nisi. Donec mi odio, faucibus ' + |
| 667 |
'at, scelerisque quis, convallis in, nisi. Suspendisse non nisl sit amet ' + |
| 668 |
'velit hendrerit rutrum. Ut leo. Ut a nisl id ante tempus hendrerit. ' + |
| 669 |
'Proin pretium, leo ac pellentesque mollis, felis nunc ultrices eros, ' + |
| 670 |
'sed gravida augue augue mollis justo. Suspendisse eu ligula. Nulla ' + |
| 671 |
'facilisi. Donec id justo. Praesent porttitor, nulla vitae posuere ' + |
| 672 |
'iaculis, arcu nisl dignissim dolor, a pretium mi sem ut ipsum. ' + |
| 673 |
'Curabitur suscipit suscipit tellus.\n\n' + |
| 674 |
|
| 675 |
'Praesent vestibulum dapibus nibh. Etiam iaculis nunc ac metus. Ut id ' + |
| 676 |
'nisl quis enim dignissim sagittis. Etiam sollicitudin, ipsum eu ' + |
| 677 |
'pulvinar rutrum, tellus ipsum laoreet sapien, quis venenatis ante ' + |
| 678 |
'odio sit amet eros. Proin magna. Duis vel nibh at velit scelerisque ' + |
| 679 |
'suscipit. Curabitur turpis. Vestibulum suscipit nulla quis orci. Fusce ' + |
| 680 |
'ac felis sit amet ligula pharetra condimentum. Maecenas egestas arcu ' + |
| 681 |
'quis ligula mattis placerat. Duis lobortis massa imperdiet quam. ' + |
| 682 |
'Suspendisse potenti.\n\n' + |
| 683 |
|
| 684 |
'Pellentesque commodo eros a enim. Vestibulum turpis sem, aliquet eget, ' + |
| 685 |
'lobortis pellentesque, rutrum eu, nisl. Sed libero. Aliquam erat ' + |
| 686 |
'volutpat. Etiam vitae tortor. Morbi vestibulum volutpat enim. Aliquam ' + |
| 687 |
'eu nunc. Nunc sed turpis. Sed mollis, eros et ultrices tempus, mauris ' + |
| 688 |
'ipsum aliquam libero, non adipiscing dolor urna a orci. Nulla porta ' + |
| 689 |
'dolor. Class aptent taciti sociosqu ad litora torquent per conubia ' + |
| 690 |
'nostra, per inceptos hymenaeos.\n\n' + |
| 691 |
|
| 692 |
'Pellentesque dapibus hendrerit tortor. Praesent egestas tristique nibh. ' + |
| 693 |
'Sed a libero. Cras varius. Donec vitae orci sed dolor rutrum auctor. ' + |
| 694 |
'Fusce egestas elit eget lorem. Suspendisse nisl elit, rhoncus eget, ' + |
| 695 |
'elementum ac, condimentum eget, diam. Nam at tortor in tellus interdum ' + |
| 696 |
'sagittis. Aliquam lobortis. Donec orci lectus, aliquam ut, faucibus ' + |
| 697 |
'non, euismod id, nulla. Curabitur blandit mollis lacus. Nam adipiscing. ' + |
| 698 |
'Vestibulum eu odio.\n\n' + |
| 699 |
|
| 700 |
'Vivamus laoreet. Nullam tincidunt adipiscing enim. Phasellus tempus. ' + |
| 701 |
'Proin viverra, ligula sit amet ultrices semper, ligula arcu tristique ' + |
| 702 |
'sapien, a accumsan nisi mauris ac eros. Fusce neque. Suspendisse ' + |
| 703 |
'faucibus, nunc et pellentesque egestas, lacus ante convallis tellus, ' + |
| 704 |
'vitae iaculis lacus elit id tortor. Vivamus aliquet elit ac nisl. Fusce ' + |
| 705 |
'fermentum odio nec arcu. Vivamus euismod mauris. In ut quam vitae ' + |
| 706 |
'odio lacinia tincidunt. Praesent ut ligula non mi varius sagittis. ' + |
| 707 |
'Cras sagittis. Praesent ac sem eget est egestas volutpat. Vivamus ' + |
| 708 |
'consectetuer hendrerit lacus. Cras non dolor. Vivamus in erat ut urna ' + |
| 709 |
'cursus vestibulum. Fusce commodo aliquam arcu. Nam commodo suscipit ' + |
| 710 |
'quam. Quisque id odio. Praesent venenatis metus at tortor pulvinar ' + |
| 711 |
'varius.\n\n'; |
| 712 |
|
| 713 |
|
| 714 |
/** |
| 715 |
* Sample that the generated text is based on . |
| 716 |
* @private {string} |
| 717 |
*/ |
| 718 |
goog.text.LoremIpsum.prototype.sample_ = goog.text.LoremIpsum.SAMPLE_; |
| 719 |
|
| 720 |
|
| 721 |
/** |
| 722 |
* Dictionary of words. |
| 723 |
* @private {string} |
| 724 |
*/ |
| 725 |
goog.text.LoremIpsum.prototype.dictionary_ = goog.text.LoremIpsum.DICT_; |