ImpUnit 0.1.1 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ImpUnit/version.rb +1 -1
  3. data/lib/ImpUnit.rb +215 -30
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccfb425b2ee0985526a81cce9b8b08b857046edc4b430c43220c29ee9a5e7c16
4
- data.tar.gz: ee6a928ce7c0297d2363649584bd4467f55ea53594602e713563b15347c7d8dc
3
+ metadata.gz: 6a1c0e4881c73c36388db72d99437326e5ba8d12d2adcbe1771561cc4931c400
4
+ data.tar.gz: 3f786a383d4bbe2ef06751f87fe6e0af0b98fa5f26e4a89a0841d3093b4baf87
5
5
  SHA512:
6
- metadata.gz: 4930e381874f9f8f4881005b824bd5d3dd7c598d62e24825ac37a4d4f06f7e42f2bc10674b475c3d4e5826dcb8fc96ef345166d14df02db8feeba51184206671
7
- data.tar.gz: 4d99f8b6647003c2078d0369c3b5ec6cee70c5ef54429e2377b8c39840fb884b180737741437ac8876268df8725ed0d711ca4b3f6a06d0371d134b08d9135caa
6
+ metadata.gz: 7b67df9ca69ca7d54e853d59a37a1911ede2fa35efeec3a4150288dd3b126a29dd3624d7bba4c03de8193b30e32eeff5db08ce6739df76410ed1957405b3c259
7
+ data.tar.gz: be7e4dbd48073877dc4528e123397bc71505b78caef39dca8d967d24534eecfaaa5c8d6f3bc4466a8089b722ccb61c66d3feaa887194e4dd5ed7678fc8e476c1
@@ -1,3 +1,3 @@
1
1
  module ImpUnit
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/ImpUnit.rb CHANGED
@@ -26,7 +26,7 @@ module ImpUnit
26
26
 
27
27
  # From matching candidate choose this script to write.
28
28
  open("exec.sh", "w") { |f|
29
- f.puts option #.tr "_", " "
29
+ f.puts option.tr "V", " "
30
30
  }
31
31
 
32
32
  # Exit script
@@ -140,46 +140,231 @@ module ImpUnit
140
140
  # Base dialogue sequence on size limit.
141
141
  size_limit.times do
142
142
 
143
- # Username logistics
144
- name_list = File.read("data/identity/name_list.txt").split(", ")
145
- name = name_list[name_number].to_s
146
- name_limit = name_list[name_number].size
143
+ # Username logistics
144
+ name_list = File.read("data/identity/name_list.txt").split(", ")
145
+ name = name_list[name_number].to_s
146
+ name_limit = name_list[name_number].size
147
147
 
148
- if name_limit > character_count
149
- name_limit = name_limit % 2
150
- else
151
- name_limit = name_limit + 1
152
- end
148
+ if name_limit > character_count
149
+ name_limit = name_limit % 2
150
+ else
151
+ name_limit = name_limit + 1
152
+ end
153
153
 
154
- old_dialogue = File.read("archive/dialogue.txt").strip.to_s
154
+ old_dialogue = File.read("archive/dialogue.txt").strip.to_s
155
155
 
156
- # Write date to file.
157
- system("date > data/date/date.txt")
156
+ # Write date to file.
157
+ system("date > data/date/date.txt")
158
158
 
159
- date = File.read("data/date/date.txt").strip
159
+ date = File.read("data/date/date.txt").strip
160
160
 
161
- # Print character dialogue to screen.
162
- print "[#{date} #{name.strip}] "; new_dialogue = gets.chomp
161
+ # Print character dialogue to screen.
162
+ print "[#{date} #{name.strip}] "; new_dialogue = gets.chomp
163
163
 
164
- # If writer specifies exit then aborts
165
- if new_dialogue == "exit"
166
- abort
164
+ # If writer specifies exit then aborts
165
+ if new_dialogue == "exit"
166
+ abort
167
+ end
168
+
169
+ # Autosaves dialogue archive. Auto appends old dialogue above new dialogue.
170
+ open("archive/dialogue.txt", "w") { |f|
171
+ f.puts old_dialogue
172
+ f.print "[#{date} #{name.strip}] "
173
+ f.puts new_dialogue
174
+ }
175
+
176
+ # Changes name as if in a chatroom.
177
+ if name_number == name_limit
178
+ name_number = 0
179
+ else
180
+ name_number = name_number + 1
181
+ end
167
182
  end
168
183
 
169
- # Autosaves dialogue archive. Auto appends old dialogue above new dialogue.
170
- open("archive/dialogue.txt", "w") { |f|
171
- f.puts old_dialogue
172
- f.print "[#{date} #{name.strip}] "
173
- f.puts new_dialogue
184
+ end
185
+ end
186
+
187
+ # This is Fraponic XML.
188
+ class FXML
189
+
190
+ # ImpUnit::FXML.rikusuto
191
+ def self.rikusuto
192
+ require "decisiontree"
193
+
194
+ # Continuous Dice
195
+ dice = [10.50, 10.75, 21.25,
196
+ 21.50, 21.75, 82.25,
197
+ 82.50, 82.75, 73.25,
198
+ 73.50, 73.75, 54.25,
199
+ 54.50, 54.75, 10.50]
200
+
201
+ input = dice.sample.to_i
202
+
203
+ attributes = ['Rikusuto']
204
+
205
+ training = [
206
+ [ 0.5, "will you get"],
207
+ [ 50.0, "will you obtain"],
208
+ [100.0, "may I have"],
209
+ ]
210
+
211
+ # Instantiate the tree, and train it based on the data (set default to '1')
212
+ dec_tree = DecisionTree::ID3Tree.new(attributes, training, 1, :continuous)
213
+ dec_tree.train
214
+
215
+ test = [input, "Jack Ryan"]
216
+
217
+ decision = dec_tree.predict(test)
218
+
219
+ # puts "Desired Result: #{decision} ... True Result: #{test.last}"
220
+
221
+ open("data/rikusuto/request.txt", "w") { |f|
222
+ f.puts decision
174
223
  }
224
+ end
175
225
 
176
- # Changes name as if in a chatroom.
177
- if name_number == name_limit
178
- name_number = 0
179
- else
180
- name_number = name_number + 1
181
- end
226
+ # ImpUnit::FXML.atemu
227
+ def self.atemu
228
+ require "decisiontree"
229
+
230
+ # Continuous Dice
231
+ dice = [10.50, 10.75, 21.25,
232
+ 21.50, 21.75, 82.25,
233
+ 82.50, 82.75, 73.25,
234
+ 73.50, 73.75, 54.25,
235
+ 54.50, 54.75, 10.50]
236
+
237
+ input = dice.sample.to_i
238
+
239
+ attributes = ['Atemu']
240
+
241
+ training = [
242
+ [ 0.5, "a banana"],
243
+ [ 25.0, "an orange"],
244
+ [ 50.0, "an apple"],
245
+ [ 75.0, "a pineapple"],
246
+ [100.0, "a lime"],
247
+ ]
248
+
249
+ # Instantiate the tree, and train it based on the data (set default to '1')
250
+ dec_tree = DecisionTree::ID3Tree.new(attributes, training, 1, :continuous)
251
+ dec_tree.train
252
+
253
+ test = [input, "an orange"]
254
+
255
+ decision = dec_tree.predict(test)
256
+
257
+ # puts "Desired Result: #{decision} ... True Result: #{test.last}"
258
+
259
+ open("data/atemu/items.txt", "w") { |f|
260
+ f.puts decision
261
+ }
262
+ end
263
+
264
+ # ImpUnit::FXML.yuza
265
+ def self.yuza
266
+ require "decisiontree"
267
+
268
+ # Continuous Dice
269
+ dice = [10.50, 10.75, 21.25,
270
+ 21.50, 21.75, 82.25,
271
+ 82.50, 82.75, 73.25,
272
+ 73.50, 73.75, 54.25,
273
+ 54.50, 54.75, 10.50]
274
+
275
+ input = dice.sample.to_i
276
+
277
+ attributes = ['Rikusuto']
278
+
279
+ training = [
280
+ [ 0.5, "Jane Smith"],
281
+ [ 50.0, "John Doe"],
282
+ [100.0, "Fred Smith"],
283
+ ]
284
+
285
+ # Instantiate the tree, and train it based on the data (set default to '1')
286
+ dec_tree = DecisionTree::ID3Tree.new(attributes, training, 1, :continuous)
287
+ dec_tree.train
288
+
289
+ test = [input, "John Doe"]
290
+
291
+ decision = dec_tree.predict(test)
292
+
293
+ # puts "Desired Result: #{decision} ... True Result: #{test.last}"
294
+
295
+ open("data/yuza/yuza.txt", "w") { |f|
296
+ f.puts decision
297
+ }
182
298
  end
183
299
 
300
+ # ImpUnit::FXML.generate
301
+ def self.generate
302
+ xml_header = '<?xml version="1.0" encoding="UTF-8"?>
303
+
304
+ <?xml-stylesheet type="text/css" href="styles/stylesheet.css"?>'
305
+
306
+ topic_header = "<topic>"
307
+ topic_bottom = "</topic>"
308
+
309
+ def salut
310
+ " <salut>Hello</salut>"
311
+ end
312
+
313
+ def ejento
314
+ agent_name = File.read("data/usr_identity/name.txt").strip.to_s
315
+
316
+ " <ejento>#{agent_name}</ejento>"
317
+ end
318
+
319
+ def rikusuto
320
+ request_type = File.read("data/rikusuto/request.txt").strip.to_s
321
+
322
+ " <rikusuto>#{request_type}</rikusuto>"
323
+ end
324
+
325
+ def atemu
326
+ item = File.read("data/atemu/items.txt").strip.to_s
327
+
328
+ " <atemu>#{item}</atemu>"
329
+ end
330
+
331
+ def nitote
332
+ " <nitote>for</nitote>"
333
+ end
334
+
335
+ def kara
336
+ " <kara>from</kara>"
337
+ end
338
+
339
+ def yuza
340
+ user_name = File.read("data/yuza/yuza.txt").strip.to_s
341
+
342
+ " <yuza>#{user_name}</yuza>"
343
+ end
344
+
345
+ def lieu
346
+ local_name = File.read("data/usr_identity/local_name.txt").strip.to_s
347
+
348
+ " <lieu>#{local_name}</lieu>"
349
+ end
350
+
351
+ conjucate = [nitote, kara]
352
+ consign = conjucate.sample
353
+
354
+ user_location = [yuza, lieu]
355
+ usign = user_location[0]
356
+
357
+ open("index.xml", "w") { |f|
358
+ f.puts xml_header
359
+ f.puts topic_header
360
+ f.puts salut
361
+ f.puts ejento
362
+ f.puts rikusuto
363
+ f.puts atemu
364
+ f.puts consign
365
+ f.puts usign
366
+ f.puts topic_bottom
367
+ }
368
+ end
184
369
  end
185
370
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ImpUnit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - LWFlouisa