ImpUnit 0.1.4 → 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.
- checksums.yaml +4 -4
- data/lib/ImpUnit/version.rb +1 -1
- data/lib/ImpUnit.rb +183 -0
- 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
@@ -184,4 +184,187 @@ module ImpUnit
|
|
184
184
|
end
|
185
185
|
end
|
186
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
|
223
|
+
}
|
224
|
+
end
|
225
|
+
|
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
|
+
}
|
298
|
+
end
|
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
|
369
|
+
end
|
187
370
|
end
|