-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.lua
359 lines (359 loc) · 5.83 KB
/
test.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
local markov = require("markov")
local str = "This is an example string. This string is delicious. This is an example set of tacos."
local example = markov(str)
for i = 1, 100 do
print(example:next())
end
print("--- --- ---")
local strings = {
"Hello world, this is a test.",
"I really don't know what I'm doing!",
"This should be interesting.",
"I need more variation here.",
"Hello friends, I'm happy.",
"I should write more things with more variation in them.",
"In here is a little world, full of knowledge."
}
local m2 = markov(strings)
math.randomseed(os.time())
for i = 1, 10 do
print(m2:string())
end
for i = 1, 5 do
print(m2:string({
max_length = 3
}))
end
local elements = {
"Hydrogen",
"Helium",
"Lithium",
"Beryllium",
"Boron",
"Carbon",
"Nitrogen",
"Oxygen",
"Fluorine",
"Neon",
"Sodium",
"Magnesium",
"Aluminium",
"Silicon",
"Phosphorus",
"Sulfur",
"Chlorine",
"Argon",
"Potassium",
"Calcium",
"Scandium",
"Titanium",
"Vanadium",
"Chromium",
"Manganese",
"Iron",
"Cobalt",
"Nickel",
"Copper",
"Zinc",
"Gallium",
"Germanium",
"Arsenic",
"Selenium",
"Bromine",
"Krypton",
"Rubidium",
"Strontium",
"Yttrium",
"Zirconium",
"Niobium",
"Molybdenum",
"Technetium",
"Ruthenium",
"Rhodium",
"Palladium",
"Silver",
"Cadmium",
"Indium",
"Tin",
"Antimony",
"Tellurium",
"Iodine",
"Xenon",
"Cesium",
"Barium",
"Lanthanum",
"Cerium",
"Praseodymium",
"Neodymium",
"Promethium",
"Samarium",
"Europium",
"Gadolinium",
"Terbium",
"Dysprosium",
"Holmium",
"Erbium",
"Thulium",
"Ytterbium",
"Lutetium",
"Hafnium",
"Tantalum",
"Tungsten",
"Rhenium",
"Osmium",
"Iridium",
"Platinum",
"Gold",
"Mercury",
"Thallium",
"Lead",
"Bismuth",
"Polonium",
"Astatine",
"Radon",
"Francium",
"Radium",
"Actinium",
"Thorium",
"Protactinium",
"Uranium",
"Neptunium",
"Plutonium",
"Americium",
"Curium",
"Berkelium",
"Californium",
"Einsteinium",
"Fermium",
"Mendelevium",
"Nobelium",
"Lawrencium",
"Rutherfordium",
"Dubnium",
"Seaborgium",
"Bohrium",
"Hassium",
"Meitnerium",
"Darmstadtium",
"Roentgenium",
"Copernicium",
"Nihonium",
"Flerovium",
"Moscovium",
"Livermorium",
"Tennessine",
"Oganesson",
"Ununennium",
pattern = "%a",
order = 2
}
local m3 = markov(elements)
print("---")
for k, v in pairs(m3.data) do
print(k)
for a, b in pairs(v) do
print("", b)
end
end
print("---")
for i = 1, 20 do
print(m3:string({
sep = "",
max_length = 13
}))
end
print("START = " .. tostring(markov.START))
print("END = " .. tostring(markov.END))
local other_things = {
"Dilithium",
"Tritium",
"Bronze",
"Protium",
"Gundanium",
"Latinum",
"Tyberium",
"Quadium",
"Adamantium",
"Etherium",
"Jasmium",
"Mithril",
"Xenium",
"Rearden",
"Zanium",
"Marizapan",
"Segnomin",
"Docherty",
"Tedium",
"Thankium",
"Geekium",
"Satisfactium",
"Alarmose",
"Cursium",
"Brainium",
"Arsole",
"Adamantane",
"Bastardane",
"Fullerene",
"Putrescine",
"Cadaverine",
"Spermine",
"Arabitol",
"Fucitol",
"Vomicine",
"Gossypol",
"Skatole",
"Sparassol",
"Psicose",
"Nonanone",
"Pubescine",
"Funicone",
"Housane",
"Domperidone",
"Germane",
"Uranate",
"Kunzite",
"Spodumene",
"Conantokin",
"Cubane",
"Anol",
"Buccalin",
"Dinile",
"Fornacite",
"Butanal",
"Clitorin",
"Fucol",
"Ovalene",
"Fuchsite",
"Pagodane",
"Apatite",
"Lepidopterene",
"Snoutene",
"Cacodyl",
"Screwene",
"Furfuryl",
"Carnallite",
"Draculin",
"Toronton",
"Praesium",
"Halivalium",
"Flubber",
"Axonite",
"Bolonium",
"Corbomite",
"Chronoton",
"Capsidium",
"Tylium",
"Acoustium",
"Necrogen",
"Tiberium",
"Metatron",
"Chorizite",
"Phazon",
"Oxyale",
"Magicite",
"Balthazate",
"Zydrine",
"Morphite",
"Tritanium",
"Nocxium",
"Elerium",
"Infernium",
"Timonium",
"Neoteutonium",
"Bendezium",
"Hellion",
"Moonsilver",
"Soulsteel",
"Orichalcum",
"Uridium",
"Psitanium",
"Zexonite",
"Sinisite",
"Tronium",
"Zfylud",
"Primium",
"Jouronium",
"Runite",
"Technoorganic",
"Vibranium",
"Zuunium",
"Nucleon",
"Redstone",
"Carbonite",
"Inerton",
"Xenothium",
"Energon",
"Calculon",
"Eternium",
"Trioxin",
"Unobtanium",
"Elephantanium",
"Turbidium",
"Schwartz",
"Balthorium",
"Galvorn",
"Byzantium",
"Aether",
"Atium",
"Australium",
"Bavarium",
"Byzanium",
"Carbonadium",
"Cavorite",
"Chlorophyte",
"Corrodium",
"Divinium",
"Duranium",
"Durium",
"Feminum",
"Frinkonium",
"Harbenite",
"Lerasium",
"Meteorillium",
"Naqahdah",
"Octiron",
"Polydenum",
"Saronite",
"Saturnium",
"Scrith",
"Taydenite",
"Uru",
"Verterium",
"Xirdalium",
"Xithricite",
"Quantium",
"Philosophon",
"Reson",
"Tachyon",
"Thaum",
"Computronium",
"Electrum",
"Neutronium",
"Nitrium",
"Trilithium",
"Kironide",
"Pergium",
"Cordrazine",
"Inaprovaline",
"Ketracel",
"Retinax",
"Archerite",
pattern = "%a",
order = 2
}
for i = 1, #elements do
table.insert(other_things, elements[i])
end
local m4 = markov(other_things)
for i = 1, 20 do
print(m4:string({
sep = "",
max_length = 13
}))
end
print("---")
m3.sep = ""
print(m3:string())
local lorem_ipsum_text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
local m5 = markov(lorem_ipsum_text)
return print(m5:string())