ImpUnit 0.1.1 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ImpUnit/version.rb +1 -1
- data/lib/ImpUnit.rb +215 -30
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a1c0e4881c73c36388db72d99437326e5ba8d12d2adcbe1771561cc4931c400
|
4
|
+
data.tar.gz: 3f786a383d4bbe2ef06751f87fe6e0af0b98fa5f26e4a89a0841d3093b4baf87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b67df9ca69ca7d54e853d59a37a1911ede2fa35efeec3a4150288dd3b126a29dd3624d7bba4c03de8193b30e32eeff5db08ce6739df76410ed1957405b3c259
|
7
|
+
data.tar.gz: be7e4dbd48073877dc4528e123397bc71505b78caef39dca8d967d24534eecfaaa5c8d6f3bc4466a8089b722ccb61c66d3feaa887194e4dd5ed7678fc8e476c1
|
data/lib/ImpUnit/version.rb
CHANGED
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
|
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
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
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
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
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
|
-
|
154
|
+
old_dialogue = File.read("archive/dialogue.txt").strip.to_s
|
155
155
|
|
156
|
-
|
157
|
-
|
156
|
+
# Write date to file.
|
157
|
+
system("date > data/date/date.txt")
|
158
158
|
|
159
|
-
|
159
|
+
date = File.read("data/date/date.txt").strip
|
160
160
|
|
161
|
-
|
162
|
-
|
161
|
+
# Print character dialogue to screen.
|
162
|
+
print "[#{date} #{name.strip}] "; new_dialogue = gets.chomp
|
163
163
|
|
164
|
-
|
165
|
-
|
166
|
-
|
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
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
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
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
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
|