[{"data":1,"prerenderedAt":1809},["ShallowReactive",2],{"project-fiction-word":3,"$r-O65_8ROZ":1808},{"id":4,"title":5,"body":6,"caseStudy":1762,"caseStudyType":1783,"demoBackground":1784,"demoMode":1784,"demoUrl":1784,"description":1785,"extension":1786,"headTitle":1787,"links":1788,"meta":1794,"navigation":200,"ogImage":1795,"path":1797,"refreshLabel":1784,"robots":1784,"schemaOrg":1798,"seo":1802,"sitemap":1803,"stem":1806,"__hash__":1807},"projects\u002Fprojects\u002Ffiction-word.md","Fiction Word",{"type":7,"value":8,"toc":1755},"minimark",[9,14,18,21,25,28,45,317,324,411,414,589,593,596,599,1043,1046,1050,1053,1736,1738,1742,1751],[10,11,13],"h2",{"id":12},"overview","Overview",[15,16,17],"p",{},"A friend of mine who was working on creating a language for a fantasy novel he was writing mentioned to me that the most difficult and tedious part of creating a language was coming up with the vocabulary. While some words are derivations or combinations of other words, much of the vocabulary needs to simply be made up.",[15,19,20],{},"He asked me if it was possible to write some code that would, based on a set of rules for what a word can be, generate random words. I thought it was an interesting idea and apart from uses in creative projects, it could possibly also be useful in generating secure, yet still memorable passwords, so I thought I'd give it a go.",[10,22,24],{"id":23},"approach","Approach",[15,26,27],{},"First, I needed the code to decide how long of a word to make.",[15,29,30,31,38,39,44],{},"Given that I wanted to base the fictional language on English, I chose to create two word-length weight charts: one for the frequency of word lengths in the dictionary (which I took from a ",[32,33,37],"a",{"href":34,"rel":35},"https:\u002F\u002Fwww.reddit.com\u002Fr\u002Fdataisbeautiful\u002Fcomments\u002F6jbt4d\u002Fa_distribution_of_english_words_by_length_using\u002F",[36],"nofollow","Reddit post",") and one for the frequency of word lengths as they are used in the English corpus (",[32,40,43],{"href":41,"rel":42},"https:\u002F\u002Fmath.wvu.edu\u002F~hdiamond\u002FMath222F17\u002FSigurd_et_al-2004-Studia_Linguistica.pdf",[36],"source",").",[46,47,52],"pre",{"className":48,"code":49,"language":50,"meta":51,"style":51},"language-typescript shiki shiki-themes github-dark","const dictionaryDistribution: [number, number][] = [\n  [1, 52],\n  [2, 488],\n  [3, 1385],\n  [4, 3688],\n  [5, 6717],\n  [6, 10268], \u002F\u002F etc...\n];\n\nconst corpusDistribution: [number, number][] = [\n  [1, 0.03],\n  [2, 0.17],\n  [3, 0.21],\n  [4, 0.16],\n  [5, 0.11],\n  [6, 0.08], \u002F\u002F etc...\n];\n","typescript","",[53,54,55,92,109,124,139,154,169,189,195,202,226,240,254,268,282,296,312],"code",{"__ignoreMap":51},[56,57,60,64,68,71,75,78,81,83,86,89],"span",{"class":58,"line":59},"line",1,[56,61,63],{"class":62},"snl16","const",[56,65,67],{"class":66},"sDLfK"," dictionaryDistribution",[56,69,70],{"class":62},":",[56,72,74],{"class":73},"s95oV"," [",[56,76,77],{"class":66},"number",[56,79,80],{"class":73},", ",[56,82,77],{"class":66},[56,84,85],{"class":73},"][] ",[56,87,88],{"class":62},"=",[56,90,91],{"class":73}," [\n",[56,93,95,98,101,103,106],{"class":58,"line":94},2,[56,96,97],{"class":73},"  [",[56,99,100],{"class":66},"1",[56,102,80],{"class":73},[56,104,105],{"class":66},"52",[56,107,108],{"class":73},"],\n",[56,110,112,114,117,119,122],{"class":58,"line":111},3,[56,113,97],{"class":73},[56,115,116],{"class":66},"2",[56,118,80],{"class":73},[56,120,121],{"class":66},"488",[56,123,108],{"class":73},[56,125,127,129,132,134,137],{"class":58,"line":126},4,[56,128,97],{"class":73},[56,130,131],{"class":66},"3",[56,133,80],{"class":73},[56,135,136],{"class":66},"1385",[56,138,108],{"class":73},[56,140,142,144,147,149,152],{"class":58,"line":141},5,[56,143,97],{"class":73},[56,145,146],{"class":66},"4",[56,148,80],{"class":73},[56,150,151],{"class":66},"3688",[56,153,108],{"class":73},[56,155,157,159,162,164,167],{"class":58,"line":156},6,[56,158,97],{"class":73},[56,160,161],{"class":66},"5",[56,163,80],{"class":73},[56,165,166],{"class":66},"6717",[56,168,108],{"class":73},[56,170,172,174,177,179,182,185],{"class":58,"line":171},7,[56,173,97],{"class":73},[56,175,176],{"class":66},"6",[56,178,80],{"class":73},[56,180,181],{"class":66},"10268",[56,183,184],{"class":73},"], ",[56,186,188],{"class":187},"sAwPA","\u002F\u002F etc...\n",[56,190,192],{"class":58,"line":191},8,[56,193,194],{"class":73},"];\n",[56,196,198],{"class":58,"line":197},9,[56,199,201],{"emptyLinePlaceholder":200},true,"\n",[56,203,205,207,210,212,214,216,218,220,222,224],{"class":58,"line":204},10,[56,206,63],{"class":62},[56,208,209],{"class":66}," corpusDistribution",[56,211,70],{"class":62},[56,213,74],{"class":73},[56,215,77],{"class":66},[56,217,80],{"class":73},[56,219,77],{"class":66},[56,221,85],{"class":73},[56,223,88],{"class":62},[56,225,91],{"class":73},[56,227,229,231,233,235,238],{"class":58,"line":228},11,[56,230,97],{"class":73},[56,232,100],{"class":66},[56,234,80],{"class":73},[56,236,237],{"class":66},"0.03",[56,239,108],{"class":73},[56,241,243,245,247,249,252],{"class":58,"line":242},12,[56,244,97],{"class":73},[56,246,116],{"class":66},[56,248,80],{"class":73},[56,250,251],{"class":66},"0.17",[56,253,108],{"class":73},[56,255,257,259,261,263,266],{"class":58,"line":256},13,[56,258,97],{"class":73},[56,260,131],{"class":66},[56,262,80],{"class":73},[56,264,265],{"class":66},"0.21",[56,267,108],{"class":73},[56,269,271,273,275,277,280],{"class":58,"line":270},14,[56,272,97],{"class":73},[56,274,146],{"class":66},[56,276,80],{"class":73},[56,278,279],{"class":66},"0.16",[56,281,108],{"class":73},[56,283,285,287,289,291,294],{"class":58,"line":284},15,[56,286,97],{"class":73},[56,288,161],{"class":66},[56,290,80],{"class":73},[56,292,293],{"class":66},"0.11",[56,295,108],{"class":73},[56,297,299,301,303,305,308,310],{"class":58,"line":298},16,[56,300,97],{"class":73},[56,302,176],{"class":66},[56,304,80],{"class":73},[56,306,307],{"class":66},"0.08",[56,309,184],{"class":73},[56,311,188],{"class":187},[56,313,315],{"class":58,"line":314},17,[56,316,194],{"class":73},[15,318,319,320,323],{},"The distribution is then mapped as numbers between 0 and 1 with the ",[53,321,322],{},"generateDistribution"," function.",[46,325,327],{"className":48,"code":326,"language":50,"meta":51,"style":51},"console.log(generateDistribution(\"corpus\"));\n\n\u002F* Output\n[\n  [ 1, 0.03 ],\n  [ 2, 0.2 ],\n  [ 3, 0.41000000000000003 ],\n  [ 4, 0.5700000000000001 ],\n  [ 5, 0.68 ],\n  [ 6, 0.76 ],\n  etc...\n]\n*\u002F\n",[53,328,329,352,356,361,366,371,376,381,386,391,396,401,406],{"__ignoreMap":51},[56,330,331,334,338,341,343,345,349],{"class":58,"line":59},[56,332,333],{"class":73},"console.",[56,335,337],{"class":336},"svObZ","log",[56,339,340],{"class":73},"(",[56,342,322],{"class":336},[56,344,340],{"class":73},[56,346,348],{"class":347},"sU2Wk","\"corpus\"",[56,350,351],{"class":73},"));\n",[56,353,354],{"class":58,"line":94},[56,355,201],{"emptyLinePlaceholder":200},[56,357,358],{"class":58,"line":111},[56,359,360],{"class":187},"\u002F* Output\n",[56,362,363],{"class":58,"line":126},[56,364,365],{"class":187},"[\n",[56,367,368],{"class":58,"line":141},[56,369,370],{"class":187},"  [ 1, 0.03 ],\n",[56,372,373],{"class":58,"line":156},[56,374,375],{"class":187},"  [ 2, 0.2 ],\n",[56,377,378],{"class":58,"line":171},[56,379,380],{"class":187},"  [ 3, 0.41000000000000003 ],\n",[56,382,383],{"class":58,"line":191},[56,384,385],{"class":187},"  [ 4, 0.5700000000000001 ],\n",[56,387,388],{"class":58,"line":197},[56,389,390],{"class":187},"  [ 5, 0.68 ],\n",[56,392,393],{"class":58,"line":204},[56,394,395],{"class":187},"  [ 6, 0.76 ],\n",[56,397,398],{"class":58,"line":228},[56,399,400],{"class":187},"  etc...\n",[56,402,403],{"class":58,"line":242},[56,404,405],{"class":187},"]\n",[56,407,408],{"class":58,"line":256},[56,409,410],{"class":187},"*\u002F\n",[15,412,413],{},"And then a word length is randomly chosen:",[46,415,417],{"className":48,"code":416,"language":50,"meta":51,"style":51},"\u002F**\n * Sample a word length from the distribution.\n * @returns A random word length.\n *\u002F\nexport function getRandomWordLength(distribution?: [number, number][]) {\n  distribution = distribution || generateDistribution(\"dictionary\");\n  const rand = Math.random();\n  for (const [length, prob] of distribution) {\n    if (rand \u003C prob) return length;\n  }\n  return sampleLongTail();\n}\n",[53,418,419,424,429,440,445,476,500,520,549,569,574,584],{"__ignoreMap":51},[56,420,421],{"class":58,"line":59},[56,422,423],{"class":187},"\u002F**\n",[56,425,426],{"class":58,"line":94},[56,427,428],{"class":187}," * Sample a word length from the distribution.\n",[56,430,431,434,437],{"class":58,"line":111},[56,432,433],{"class":187}," * ",[56,435,436],{"class":62},"@returns",[56,438,439],{"class":187}," A random word length.\n",[56,441,442],{"class":58,"line":126},[56,443,444],{"class":187}," *\u002F\n",[56,446,447,450,453,456,458,462,465,467,469,471,473],{"class":58,"line":141},[56,448,449],{"class":62},"export",[56,451,452],{"class":62}," function",[56,454,455],{"class":336}," getRandomWordLength",[56,457,340],{"class":73},[56,459,461],{"class":460},"s9osk","distribution",[56,463,464],{"class":62},"?:",[56,466,74],{"class":73},[56,468,77],{"class":66},[56,470,80],{"class":73},[56,472,77],{"class":66},[56,474,475],{"class":73},"][]) {\n",[56,477,478,481,483,486,489,492,494,497],{"class":58,"line":156},[56,479,480],{"class":73},"  distribution ",[56,482,88],{"class":62},[56,484,485],{"class":73}," distribution ",[56,487,488],{"class":62},"||",[56,490,491],{"class":336}," generateDistribution",[56,493,340],{"class":73},[56,495,496],{"class":347},"\"dictionary\"",[56,498,499],{"class":73},");\n",[56,501,502,505,508,511,514,517],{"class":58,"line":171},[56,503,504],{"class":62},"  const",[56,506,507],{"class":66}," rand",[56,509,510],{"class":62}," =",[56,512,513],{"class":73}," Math.",[56,515,516],{"class":336},"random",[56,518,519],{"class":73},"();\n",[56,521,522,525,528,530,532,535,537,540,543,546],{"class":58,"line":191},[56,523,524],{"class":62},"  for",[56,526,527],{"class":73}," (",[56,529,63],{"class":62},[56,531,74],{"class":73},[56,533,534],{"class":66},"length",[56,536,80],{"class":73},[56,538,539],{"class":66},"prob",[56,541,542],{"class":73},"] ",[56,544,545],{"class":62},"of",[56,547,548],{"class":73}," distribution) {\n",[56,550,551,554,557,560,563,566],{"class":58,"line":197},[56,552,553],{"class":62},"    if",[56,555,556],{"class":73}," (rand ",[56,558,559],{"class":62},"\u003C",[56,561,562],{"class":73}," prob) ",[56,564,565],{"class":62},"return",[56,567,568],{"class":73}," length;\n",[56,570,571],{"class":58,"line":204},[56,572,573],{"class":73},"  }\n",[56,575,576,579,582],{"class":58,"line":228},[56,577,578],{"class":62},"  return",[56,580,581],{"class":336}," sampleLongTail",[56,583,519],{"class":73},[56,585,586],{"class":58,"line":242},[56,587,588],{"class":73},"}\n",[10,590,592],{"id":591},"building-words","Building words",[15,594,595],{},"Once the word length is determined, the script can start building words. The main function works by constructing a word, letter-by-letter or cluster-by-cluster, alternating between vowels and consonants until it matches the determined length, then returning the result.",[15,597,598],{},"More specifically, it works by looking at the word so far and determining which of the following arrays are viable options for what's next, with the marked letters used sparingly:",[46,600,602],{"className":48,"code":601,"language":50,"meta":51,"style":51},"const prefixes = [\"str\", \"pre\", \"dia\", \"gh\", \"wh\", \"psy\"];\nconst suffixes = [\"tion\", \"ing\", \"ies\", \"ed\", \"er\", \"ght\", \"gh\", \"ck\", \"ff\", \"que\", \"nd\"];\nconst vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"y\"];\nconst consonants = [\n  ...[\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\"],\n  ...[\"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"x\", \"z\", \"w\", \"y\"],\n];\nconst marked = [\"z\", \"x\", \"j\"];\nconst consonantCluster = [\n  ...[\"tr\", \"sc\", \"th\", \"sh\", \"ch\", \"br\", \"bl\", \"cl\", \"cr\"],\n  ...[\"ff\", \"que\", \"qu\", \"dr\", \"sw\"],\n];\nconst dipthong = [\"ee\", \"ea\", \"io\", \"oo\", \"ou\", \"eau\"];\n",[53,603,604,645,710,751,762,820,880,884,907,918,969,998,1002],{"__ignoreMap":51},[56,605,606,608,611,613,615,618,620,623,625,628,630,633,635,638,640,643],{"class":58,"line":59},[56,607,63],{"class":62},[56,609,610],{"class":66}," prefixes",[56,612,510],{"class":62},[56,614,74],{"class":73},[56,616,617],{"class":347},"\"str\"",[56,619,80],{"class":73},[56,621,622],{"class":347},"\"pre\"",[56,624,80],{"class":73},[56,626,627],{"class":347},"\"dia\"",[56,629,80],{"class":73},[56,631,632],{"class":347},"\"gh\"",[56,634,80],{"class":73},[56,636,637],{"class":347},"\"wh\"",[56,639,80],{"class":73},[56,641,642],{"class":347},"\"psy\"",[56,644,194],{"class":73},[56,646,647,649,652,654,656,659,661,664,666,669,671,674,676,679,681,684,686,688,690,693,695,698,700,703,705,708],{"class":58,"line":94},[56,648,63],{"class":62},[56,650,651],{"class":66}," suffixes",[56,653,510],{"class":62},[56,655,74],{"class":73},[56,657,658],{"class":347},"\"tion\"",[56,660,80],{"class":73},[56,662,663],{"class":347},"\"ing\"",[56,665,80],{"class":73},[56,667,668],{"class":347},"\"ies\"",[56,670,80],{"class":73},[56,672,673],{"class":347},"\"ed\"",[56,675,80],{"class":73},[56,677,678],{"class":347},"\"er\"",[56,680,80],{"class":73},[56,682,683],{"class":347},"\"ght\"",[56,685,80],{"class":73},[56,687,632],{"class":347},[56,689,80],{"class":73},[56,691,692],{"class":347},"\"ck\"",[56,694,80],{"class":73},[56,696,697],{"class":347},"\"ff\"",[56,699,80],{"class":73},[56,701,702],{"class":347},"\"que\"",[56,704,80],{"class":73},[56,706,707],{"class":347},"\"nd\"",[56,709,194],{"class":73},[56,711,712,714,717,719,721,724,726,729,731,734,736,739,741,744,746,749],{"class":58,"line":111},[56,713,63],{"class":62},[56,715,716],{"class":66}," vowels",[56,718,510],{"class":62},[56,720,74],{"class":73},[56,722,723],{"class":347},"\"a\"",[56,725,80],{"class":73},[56,727,728],{"class":347},"\"e\"",[56,730,80],{"class":73},[56,732,733],{"class":347},"\"i\"",[56,735,80],{"class":73},[56,737,738],{"class":347},"\"o\"",[56,740,80],{"class":73},[56,742,743],{"class":347},"\"u\"",[56,745,80],{"class":73},[56,747,748],{"class":347},"\"y\"",[56,750,194],{"class":73},[56,752,753,755,758,760],{"class":58,"line":126},[56,754,63],{"class":62},[56,756,757],{"class":66}," consonants",[56,759,510],{"class":62},[56,761,91],{"class":73},[56,763,764,767,770,773,775,778,780,783,785,788,790,793,795,798,800,803,805,808,810,813,815,818],{"class":58,"line":141},[56,765,766],{"class":62},"  ...",[56,768,769],{"class":73},"[",[56,771,772],{"class":347},"\"b\"",[56,774,80],{"class":73},[56,776,777],{"class":347},"\"c\"",[56,779,80],{"class":73},[56,781,782],{"class":347},"\"d\"",[56,784,80],{"class":73},[56,786,787],{"class":347},"\"f\"",[56,789,80],{"class":73},[56,791,792],{"class":347},"\"g\"",[56,794,80],{"class":73},[56,796,797],{"class":347},"\"h\"",[56,799,80],{"class":73},[56,801,802],{"class":347},"\"j\"",[56,804,80],{"class":73},[56,806,807],{"class":347},"\"k\"",[56,809,80],{"class":73},[56,811,812],{"class":347},"\"l\"",[56,814,80],{"class":73},[56,816,817],{"class":347},"\"m\"",[56,819,108],{"class":73},[56,821,822,824,826,829,831,834,836,839,841,844,846,849,851,854,856,859,861,864,866,869,871,874,876,878],{"class":58,"line":156},[56,823,766],{"class":62},[56,825,769],{"class":73},[56,827,828],{"class":347},"\"n\"",[56,830,80],{"class":73},[56,832,833],{"class":347},"\"p\"",[56,835,80],{"class":73},[56,837,838],{"class":347},"\"q\"",[56,840,80],{"class":73},[56,842,843],{"class":347},"\"r\"",[56,845,80],{"class":73},[56,847,848],{"class":347},"\"s\"",[56,850,80],{"class":73},[56,852,853],{"class":347},"\"t\"",[56,855,80],{"class":73},[56,857,858],{"class":347},"\"v\"",[56,860,80],{"class":73},[56,862,863],{"class":347},"\"x\"",[56,865,80],{"class":73},[56,867,868],{"class":347},"\"z\"",[56,870,80],{"class":73},[56,872,873],{"class":347},"\"w\"",[56,875,80],{"class":73},[56,877,748],{"class":347},[56,879,108],{"class":73},[56,881,882],{"class":58,"line":171},[56,883,194],{"class":73},[56,885,886,888,891,893,895,897,899,901,903,905],{"class":58,"line":191},[56,887,63],{"class":62},[56,889,890],{"class":66}," marked",[56,892,510],{"class":62},[56,894,74],{"class":73},[56,896,868],{"class":347},[56,898,80],{"class":73},[56,900,863],{"class":347},[56,902,80],{"class":73},[56,904,802],{"class":347},[56,906,194],{"class":73},[56,908,909,911,914,916],{"class":58,"line":197},[56,910,63],{"class":62},[56,912,913],{"class":66}," consonantCluster",[56,915,510],{"class":62},[56,917,91],{"class":73},[56,919,920,922,924,927,929,932,934,937,939,942,944,947,949,952,954,957,959,962,964,967],{"class":58,"line":204},[56,921,766],{"class":62},[56,923,769],{"class":73},[56,925,926],{"class":347},"\"tr\"",[56,928,80],{"class":73},[56,930,931],{"class":347},"\"sc\"",[56,933,80],{"class":73},[56,935,936],{"class":347},"\"th\"",[56,938,80],{"class":73},[56,940,941],{"class":347},"\"sh\"",[56,943,80],{"class":73},[56,945,946],{"class":347},"\"ch\"",[56,948,80],{"class":73},[56,950,951],{"class":347},"\"br\"",[56,953,80],{"class":73},[56,955,956],{"class":347},"\"bl\"",[56,958,80],{"class":73},[56,960,961],{"class":347},"\"cl\"",[56,963,80],{"class":73},[56,965,966],{"class":347},"\"cr\"",[56,968,108],{"class":73},[56,970,971,973,975,977,979,981,983,986,988,991,993,996],{"class":58,"line":228},[56,972,766],{"class":62},[56,974,769],{"class":73},[56,976,697],{"class":347},[56,978,80],{"class":73},[56,980,702],{"class":347},[56,982,80],{"class":73},[56,984,985],{"class":347},"\"qu\"",[56,987,80],{"class":73},[56,989,990],{"class":347},"\"dr\"",[56,992,80],{"class":73},[56,994,995],{"class":347},"\"sw\"",[56,997,108],{"class":73},[56,999,1000],{"class":58,"line":242},[56,1001,194],{"class":73},[56,1003,1004,1006,1009,1011,1013,1016,1018,1021,1023,1026,1028,1031,1033,1036,1038,1041],{"class":58,"line":256},[56,1005,63],{"class":62},[56,1007,1008],{"class":66}," dipthong",[56,1010,510],{"class":62},[56,1012,74],{"class":73},[56,1014,1015],{"class":347},"\"ee\"",[56,1017,80],{"class":73},[56,1019,1020],{"class":347},"\"ea\"",[56,1022,80],{"class":73},[56,1024,1025],{"class":347},"\"io\"",[56,1027,80],{"class":73},[56,1029,1030],{"class":347},"\"oo\"",[56,1032,80],{"class":73},[56,1034,1035],{"class":347},"\"ou\"",[56,1037,80],{"class":73},[56,1039,1040],{"class":347},"\"eau\"",[56,1042,194],{"class":73},[1044,1045],"hr",{},[10,1047,1049],{"id":1048},"from-words-to-text","From words to text",[15,1051,1052],{},"After the initial fun of creating the words, I thought that the script could be useful as a tool for creating lorem-ipsum-like text. So I expanded it to include a function that creates sentences and another that creates paragraphs.",[46,1054,1056],{"className":48,"code":1055,"language":50,"meta":51,"style":51},"\u002F**\n * @description Generates a sentence with a given length or a normally distributed number.\n * @param options - Either the given length of the sentence in words or an object containing full options.\n * @returns The generated sentence.\n *\u002F\nexport const makeSentence = (options?: number | IpsumOptions): string => {\n  let length = typeof options === \"number\" ? options : options?.length;\n  const allOptions = typeof options === \"object\" ? options : {};\n\n  const distribution = allOptions.wordDistribution || generateDistribution(\"corpus\");\n  const sentenceDistribution = allOptions.sentenceDistribution || generateDistribution(\"sentence\");\n\n  length = Math.max(1, length || getRandomLengthFromDistribution(sentenceDistribution));\n  let sentence = `${capitalizeFirstLetter(makeWord({ distribution }))} `;\n  for (let i = 1; i \u003C length; i++) {\n    sentence += `${makeWord({ distribution })} `;\n  }\n\n  return `${sentence.trim()}.`;\n};\n\n\u002F**\n * @description Generates a paragraph with a given length or a normally distributed number.\n * @param options - Either the given length of the paragraph in sentences or an object containing full options.\n * @returns The generated paragraph.\n *\u002F\nexport const makeParagraph = (options?: number | IpsumOptions): string => {\n  let length = typeof options === \"number\" ? options : options?.length;\n  const allOptions = typeof options === \"object\" ? options : {};\n\n  const wordDistribution = allOptions.wordDistribution || generateDistribution(\"corpus\");\n  const sentenceDistribution = allOptions.sentenceDistribution || generateDistribution(\"sentence\");\n\n  length = Math.max(1, length || Math.round(gaussianRandom(5, 1.2)));\n  let paragraph = \"\";\n  for (let i = 0; i \u003C length; i++) {\n    paragraph += `${makeSentence({ wordDistribution, sentenceDistribution })} `;\n  }\n\n  return paragraph.trim();\n};\n",[53,1057,1058,1062,1072,1085,1094,1098,1140,1177,1204,1208,1230,1253,1257,1284,1317,1348,1371,1375,1380,1404,1410,1415,1420,1430,1442,1452,1457,1491,1520,1545,1550,1572,1593,1598,1639,1654,1680,1709,1714,1719,1731],{"__ignoreMap":51},[56,1059,1060],{"class":58,"line":59},[56,1061,423],{"class":187},[56,1063,1064,1066,1069],{"class":58,"line":94},[56,1065,433],{"class":187},[56,1067,1068],{"class":62},"@description",[56,1070,1071],{"class":187}," Generates a sentence with a given length or a normally distributed number.\n",[56,1073,1074,1076,1079,1082],{"class":58,"line":111},[56,1075,433],{"class":187},[56,1077,1078],{"class":62},"@param",[56,1080,1081],{"class":73}," options",[56,1083,1084],{"class":187}," - Either the given length of the sentence in words or an object containing full options.\n",[56,1086,1087,1089,1091],{"class":58,"line":126},[56,1088,433],{"class":187},[56,1090,436],{"class":62},[56,1092,1093],{"class":187}," The generated sentence.\n",[56,1095,1096],{"class":58,"line":141},[56,1097,444],{"class":187},[56,1099,1100,1102,1105,1108,1110,1112,1115,1117,1120,1123,1126,1129,1131,1134,1137],{"class":58,"line":156},[56,1101,449],{"class":62},[56,1103,1104],{"class":62}," const",[56,1106,1107],{"class":336}," makeSentence",[56,1109,510],{"class":62},[56,1111,527],{"class":73},[56,1113,1114],{"class":460},"options",[56,1116,464],{"class":62},[56,1118,1119],{"class":66}," number",[56,1121,1122],{"class":62}," |",[56,1124,1125],{"class":336}," IpsumOptions",[56,1127,1128],{"class":73},")",[56,1130,70],{"class":62},[56,1132,1133],{"class":66}," string",[56,1135,1136],{"class":62}," =>",[56,1138,1139],{"class":73}," {\n",[56,1141,1142,1145,1148,1150,1153,1156,1159,1162,1165,1167,1169,1172,1174],{"class":58,"line":171},[56,1143,1144],{"class":62},"  let",[56,1146,1147],{"class":73}," length ",[56,1149,88],{"class":62},[56,1151,1152],{"class":62}," typeof",[56,1154,1155],{"class":73}," options ",[56,1157,1158],{"class":62},"===",[56,1160,1161],{"class":347}," \"number\"",[56,1163,1164],{"class":62}," ?",[56,1166,1155],{"class":73},[56,1168,70],{"class":62},[56,1170,1171],{"class":73}," options?.",[56,1173,534],{"class":66},[56,1175,1176],{"class":73},";\n",[56,1178,1179,1181,1184,1186,1188,1190,1192,1195,1197,1199,1201],{"class":58,"line":191},[56,1180,504],{"class":62},[56,1182,1183],{"class":66}," allOptions",[56,1185,510],{"class":62},[56,1187,1152],{"class":62},[56,1189,1155],{"class":73},[56,1191,1158],{"class":62},[56,1193,1194],{"class":347}," \"object\"",[56,1196,1164],{"class":62},[56,1198,1155],{"class":73},[56,1200,70],{"class":62},[56,1202,1203],{"class":73}," {};\n",[56,1205,1206],{"class":58,"line":197},[56,1207,201],{"emptyLinePlaceholder":200},[56,1209,1210,1212,1215,1217,1220,1222,1224,1226,1228],{"class":58,"line":204},[56,1211,504],{"class":62},[56,1213,1214],{"class":66}," distribution",[56,1216,510],{"class":62},[56,1218,1219],{"class":73}," allOptions.wordDistribution ",[56,1221,488],{"class":62},[56,1223,491],{"class":336},[56,1225,340],{"class":73},[56,1227,348],{"class":347},[56,1229,499],{"class":73},[56,1231,1232,1234,1237,1239,1242,1244,1246,1248,1251],{"class":58,"line":228},[56,1233,504],{"class":62},[56,1235,1236],{"class":66}," sentenceDistribution",[56,1238,510],{"class":62},[56,1240,1241],{"class":73}," allOptions.sentenceDistribution ",[56,1243,488],{"class":62},[56,1245,491],{"class":336},[56,1247,340],{"class":73},[56,1249,1250],{"class":347},"\"sentence\"",[56,1252,499],{"class":73},[56,1254,1255],{"class":58,"line":242},[56,1256,201],{"emptyLinePlaceholder":200},[56,1258,1259,1262,1264,1266,1269,1271,1273,1276,1278,1281],{"class":58,"line":256},[56,1260,1261],{"class":73},"  length ",[56,1263,88],{"class":62},[56,1265,513],{"class":73},[56,1267,1268],{"class":336},"max",[56,1270,340],{"class":73},[56,1272,100],{"class":66},[56,1274,1275],{"class":73},", length ",[56,1277,488],{"class":62},[56,1279,1280],{"class":336}," getRandomLengthFromDistribution",[56,1282,1283],{"class":73},"(sentenceDistribution));\n",[56,1285,1286,1288,1291,1293,1296,1299,1301,1304,1307,1309,1312,1315],{"class":58,"line":270},[56,1287,1144],{"class":62},[56,1289,1290],{"class":73}," sentence ",[56,1292,88],{"class":62},[56,1294,1295],{"class":347}," `${",[56,1297,1298],{"class":336},"capitalizeFirstLetter",[56,1300,340],{"class":347},[56,1302,1303],{"class":336},"makeWord",[56,1305,1306],{"class":347},"({ ",[56,1308,461],{"class":73},[56,1310,1311],{"class":347}," }))",[56,1313,1314],{"class":347},"} `",[56,1316,1176],{"class":73},[56,1318,1319,1321,1323,1326,1329,1331,1334,1337,1339,1342,1345],{"class":58,"line":284},[56,1320,524],{"class":62},[56,1322,527],{"class":73},[56,1324,1325],{"class":62},"let",[56,1327,1328],{"class":73}," i ",[56,1330,88],{"class":62},[56,1332,1333],{"class":66}," 1",[56,1335,1336],{"class":73},"; i ",[56,1338,559],{"class":62},[56,1340,1341],{"class":73}," length; i",[56,1343,1344],{"class":62},"++",[56,1346,1347],{"class":73},") {\n",[56,1349,1350,1353,1356,1358,1360,1362,1364,1367,1369],{"class":58,"line":298},[56,1351,1352],{"class":73},"    sentence ",[56,1354,1355],{"class":62},"+=",[56,1357,1295],{"class":347},[56,1359,1303],{"class":336},[56,1361,1306],{"class":347},[56,1363,461],{"class":73},[56,1365,1366],{"class":347}," })",[56,1368,1314],{"class":347},[56,1370,1176],{"class":73},[56,1372,1373],{"class":58,"line":314},[56,1374,573],{"class":73},[56,1376,1378],{"class":58,"line":1377},18,[56,1379,201],{"emptyLinePlaceholder":200},[56,1381,1383,1385,1387,1390,1393,1396,1399,1402],{"class":58,"line":1382},19,[56,1384,578],{"class":62},[56,1386,1295],{"class":347},[56,1388,1389],{"class":73},"sentence",[56,1391,1392],{"class":347},".",[56,1394,1395],{"class":336},"trim",[56,1397,1398],{"class":347},"()",[56,1400,1401],{"class":347},"}.`",[56,1403,1176],{"class":73},[56,1405,1407],{"class":58,"line":1406},20,[56,1408,1409],{"class":73},"};\n",[56,1411,1413],{"class":58,"line":1412},21,[56,1414,201],{"emptyLinePlaceholder":200},[56,1416,1418],{"class":58,"line":1417},22,[56,1419,423],{"class":187},[56,1421,1423,1425,1427],{"class":58,"line":1422},23,[56,1424,433],{"class":187},[56,1426,1068],{"class":62},[56,1428,1429],{"class":187}," Generates a paragraph with a given length or a normally distributed number.\n",[56,1431,1433,1435,1437,1439],{"class":58,"line":1432},24,[56,1434,433],{"class":187},[56,1436,1078],{"class":62},[56,1438,1081],{"class":73},[56,1440,1441],{"class":187}," - Either the given length of the paragraph in sentences or an object containing full options.\n",[56,1443,1445,1447,1449],{"class":58,"line":1444},25,[56,1446,433],{"class":187},[56,1448,436],{"class":62},[56,1450,1451],{"class":187}," The generated paragraph.\n",[56,1453,1455],{"class":58,"line":1454},26,[56,1456,444],{"class":187},[56,1458,1460,1462,1464,1467,1469,1471,1473,1475,1477,1479,1481,1483,1485,1487,1489],{"class":58,"line":1459},27,[56,1461,449],{"class":62},[56,1463,1104],{"class":62},[56,1465,1466],{"class":336}," makeParagraph",[56,1468,510],{"class":62},[56,1470,527],{"class":73},[56,1472,1114],{"class":460},[56,1474,464],{"class":62},[56,1476,1119],{"class":66},[56,1478,1122],{"class":62},[56,1480,1125],{"class":336},[56,1482,1128],{"class":73},[56,1484,70],{"class":62},[56,1486,1133],{"class":66},[56,1488,1136],{"class":62},[56,1490,1139],{"class":73},[56,1492,1494,1496,1498,1500,1502,1504,1506,1508,1510,1512,1514,1516,1518],{"class":58,"line":1493},28,[56,1495,1144],{"class":62},[56,1497,1147],{"class":73},[56,1499,88],{"class":62},[56,1501,1152],{"class":62},[56,1503,1155],{"class":73},[56,1505,1158],{"class":62},[56,1507,1161],{"class":347},[56,1509,1164],{"class":62},[56,1511,1155],{"class":73},[56,1513,70],{"class":62},[56,1515,1171],{"class":73},[56,1517,534],{"class":66},[56,1519,1176],{"class":73},[56,1521,1523,1525,1527,1529,1531,1533,1535,1537,1539,1541,1543],{"class":58,"line":1522},29,[56,1524,504],{"class":62},[56,1526,1183],{"class":66},[56,1528,510],{"class":62},[56,1530,1152],{"class":62},[56,1532,1155],{"class":73},[56,1534,1158],{"class":62},[56,1536,1194],{"class":347},[56,1538,1164],{"class":62},[56,1540,1155],{"class":73},[56,1542,70],{"class":62},[56,1544,1203],{"class":73},[56,1546,1548],{"class":58,"line":1547},30,[56,1549,201],{"emptyLinePlaceholder":200},[56,1551,1553,1555,1558,1560,1562,1564,1566,1568,1570],{"class":58,"line":1552},31,[56,1554,504],{"class":62},[56,1556,1557],{"class":66}," wordDistribution",[56,1559,510],{"class":62},[56,1561,1219],{"class":73},[56,1563,488],{"class":62},[56,1565,491],{"class":336},[56,1567,340],{"class":73},[56,1569,348],{"class":347},[56,1571,499],{"class":73},[56,1573,1575,1577,1579,1581,1583,1585,1587,1589,1591],{"class":58,"line":1574},32,[56,1576,504],{"class":62},[56,1578,1236],{"class":66},[56,1580,510],{"class":62},[56,1582,1241],{"class":73},[56,1584,488],{"class":62},[56,1586,491],{"class":336},[56,1588,340],{"class":73},[56,1590,1250],{"class":347},[56,1592,499],{"class":73},[56,1594,1596],{"class":58,"line":1595},33,[56,1597,201],{"emptyLinePlaceholder":200},[56,1599,1601,1603,1605,1607,1609,1611,1613,1615,1617,1619,1622,1624,1627,1629,1631,1633,1636],{"class":58,"line":1600},34,[56,1602,1261],{"class":73},[56,1604,88],{"class":62},[56,1606,513],{"class":73},[56,1608,1268],{"class":336},[56,1610,340],{"class":73},[56,1612,100],{"class":66},[56,1614,1275],{"class":73},[56,1616,488],{"class":62},[56,1618,513],{"class":73},[56,1620,1621],{"class":336},"round",[56,1623,340],{"class":73},[56,1625,1626],{"class":336},"gaussianRandom",[56,1628,340],{"class":73},[56,1630,161],{"class":66},[56,1632,80],{"class":73},[56,1634,1635],{"class":66},"1.2",[56,1637,1638],{"class":73},")));\n",[56,1640,1642,1644,1647,1649,1652],{"class":58,"line":1641},35,[56,1643,1144],{"class":62},[56,1645,1646],{"class":73}," paragraph ",[56,1648,88],{"class":62},[56,1650,1651],{"class":347}," \"\"",[56,1653,1176],{"class":73},[56,1655,1657,1659,1661,1663,1665,1667,1670,1672,1674,1676,1678],{"class":58,"line":1656},36,[56,1658,524],{"class":62},[56,1660,527],{"class":73},[56,1662,1325],{"class":62},[56,1664,1328],{"class":73},[56,1666,88],{"class":62},[56,1668,1669],{"class":66}," 0",[56,1671,1336],{"class":73},[56,1673,559],{"class":62},[56,1675,1341],{"class":73},[56,1677,1344],{"class":62},[56,1679,1347],{"class":73},[56,1681,1683,1686,1688,1690,1693,1695,1698,1700,1703,1705,1707],{"class":58,"line":1682},37,[56,1684,1685],{"class":73},"    paragraph ",[56,1687,1355],{"class":62},[56,1689,1295],{"class":347},[56,1691,1692],{"class":336},"makeSentence",[56,1694,1306],{"class":347},[56,1696,1697],{"class":73},"wordDistribution",[56,1699,80],{"class":347},[56,1701,1702],{"class":73},"sentenceDistribution",[56,1704,1366],{"class":347},[56,1706,1314],{"class":347},[56,1708,1176],{"class":73},[56,1710,1712],{"class":58,"line":1711},38,[56,1713,573],{"class":73},[56,1715,1717],{"class":58,"line":1716},39,[56,1718,201],{"emptyLinePlaceholder":200},[56,1720,1722,1724,1727,1729],{"class":58,"line":1721},40,[56,1723,578],{"class":62},[56,1725,1726],{"class":73}," paragraph.",[56,1728,1395],{"class":336},[56,1730,519],{"class":73},[56,1732,1734],{"class":58,"line":1733},41,[56,1735,1409],{"class":73},[1044,1737],{},[10,1739,1741],{"id":1740},"whats-next","What’s next",[15,1743,1744,1745,1750],{},"You can create words and give them definitions at ",[32,1746,1749],{"href":1747,"rel":1748},"https:\u002F\u002Fwww.thedukeofnorfolk.com\u002Fatelier\u002Fwords\u002Fcreate",[36],"thedukeofnorfolk.com",". I intend to eventually create a crowdsourced dictionary of fictional words.",[1752,1753,1754],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":51,"searchDepth":94,"depth":94,"links":1756},[1757,1758,1759,1760,1761],{"id":12,"depth":94,"text":13},{"id":23,"depth":94,"text":24},{"id":591,"depth":94,"text":592},{"id":1048,"depth":94,"text":1049},{"id":1740,"depth":94,"text":1741},{"role":1763,"year":1764,"status":1765,"disciplines":1766,"stack":1770,"challenge":1774,"outcome":1775,"primaryAction":1776,"demoInstructions":1779,"related":1780},"Creator & package author","Ongoing","Published open-source utility",[1767,1768,1769],"Creative tooling","Generative systems","Language play",[1771,1772,1773],"TypeScript","npm","Probability distributions","Generate words that feel pronounceable and varied while giving writers useful control over the resulting text.","A small npm utility that generates fictional words, sentences, and paragraphs from weighted language patterns.",{"title":1777,"link":1778,"source":1772},"View package","https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Ffiction-word","Choose a word, sentence, or paragraph to generate a new sample. The text is created in this page and can be tried without leaving it.",{"label":1781,"to":1782},"Return to all development work","\u002Fdev","Development case study",null,"Fiction Word is a simple tool to generate random words, sentences, and paragraphs.","md","ATH: Dev - Fiction Word",[1789,1790],{"link":1778,"source":1772},{"title":1791,"link":1792,"source":1793},"GitHub","https:\u002F\u002Fgithub.com\u002Fhowardah\u002Ffiction-word","github",{},{"url":1796},"\u002Fimages\u002Fdev\u002Ffiction-word.webp","\u002Fprojects\u002Ffiction-word",[1799],{"name":5,"applicationCategory":1800,"@type":1801},"DeveloperApplication","SoftwareApplication",{"title":5,"description":1785},{"loc":1797,"changefreq":1804,"priority":1805},"monthly",0.7,"projects\u002Ffiction-word","vuyYXiCXZmOyT1poxEcVIALmrA5UjTrT6_MBeO5jDDI","Dugeaque",1786815543349]