aac-metrics 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aac-metrics/metrics.rb +24 -7
- data/sets/fringe.en.json +2112 -2
- 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: 5a2c7146372a916bfc65d6d4d50dda6b2a7a27aaf16fc59f3786e7dc38d87f49
|
4
|
+
data.tar.gz: ea1f5629b498e2f79e4bd9cd5d5d03085f4088da10f351fc1f52187b05744cda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 178c2851f81ecb92e0d97a77a9553ecabcc97baca6fc4d717e8ea2b081e7318cbeb5552a876af896618d979dd7ff4277b2a24c5e32cd6359345f8a760b36eee3
|
7
|
+
data.tar.gz: 63d7a6cf112e6fc53f7630cf478a37d57374d4b52c934d2c215614b307555486bb34de34316b7255daa2884d51e887c0f380abfdeb85218035d5c4c34df2d68a
|
data/lib/aac-metrics/metrics.rb
CHANGED
@@ -256,14 +256,17 @@ module AACMetrics::Metrics
|
|
256
256
|
compare_words = []
|
257
257
|
compare_buttons = {}
|
258
258
|
comp_efforts = {}
|
259
|
+
comp_levels = {}
|
259
260
|
compare[:buttons].each do |btn|
|
260
261
|
compare_words << btn[:label]
|
261
262
|
compare_buttons[btn[:label]] = btn
|
262
263
|
comp_efforts[btn[:label]] = btn[:effort]
|
264
|
+
comp_levels[btn[:label]] = btn[:level]
|
263
265
|
end
|
264
266
|
|
265
267
|
sortable_efforts = {}
|
266
268
|
target_efforts = {}
|
269
|
+
target_levels = {}
|
267
270
|
target_words = []
|
268
271
|
# Track effort scores for each button in the set,
|
269
272
|
# used to sort and for assessing priority
|
@@ -272,6 +275,7 @@ module AACMetrics::Metrics
|
|
272
275
|
res[:buttons].each{|b|
|
273
276
|
target_words << b[:label]
|
274
277
|
target_efforts[b[:label]] = b[:effort]
|
278
|
+
target_levels[b[:label]] = b[:level]
|
275
279
|
sortable_efforts[b[:label]] = b[:effort]
|
276
280
|
comp = compare_buttons[b[:label]]
|
277
281
|
if comp
|
@@ -414,7 +418,6 @@ module AACMetrics::Metrics
|
|
414
418
|
res[:cores][list['id']] = {name: list['name'], list: list['words'], average_effort: list_effort, comp_effort: comp_effort}
|
415
419
|
end
|
416
420
|
target_effort_tally = (target_effort_tally / core_lists.to_a.length) * 5.0
|
417
|
-
|
418
421
|
comp_effort_tally = (comp_effort_tally / core_lists.to_a.length) * 5.0
|
419
422
|
|
420
423
|
# TODO: Assemble or allow a battery of word combinations,
|
@@ -422,27 +425,41 @@ module AACMetrics::Metrics
|
|
422
425
|
# as well as an average level of effort across combinations.
|
423
426
|
res[:sentences] = []
|
424
427
|
sentences.each do |words|
|
425
|
-
puts " #{words.join(' ')}"
|
426
|
-
BOARD_CHANGE_PROCESSING_EFFORT
|
427
428
|
target_effort_score = 0.0
|
428
429
|
comp_effort_score = 0.0
|
429
430
|
words.each_with_index do |word, idx|
|
430
431
|
synonym_words = [word] + (synonyms[word] || [])
|
431
432
|
effort = target_efforts[word] || target_efforts[word.downcase]
|
433
|
+
level = target_levels[word] || target_levels[word.downcase]
|
432
434
|
if !effort
|
433
|
-
synonym_words.each
|
435
|
+
synonym_words.each do |w|
|
436
|
+
if !effort && target_efforts[w]
|
437
|
+
effort = target_efforts[w]
|
438
|
+
level = target_levels[w]
|
439
|
+
end
|
440
|
+
end
|
434
441
|
end
|
435
442
|
effort ||= spelling_effort(word)
|
436
|
-
|
443
|
+
if level && level > 0 && idx > 0
|
444
|
+
effort += BOARD_CHANGE_PROCESSING_EFFORT
|
445
|
+
end
|
437
446
|
ee = effort
|
438
447
|
target_effort_score += effort
|
439
448
|
|
440
449
|
effort = comp_efforts[word] || comp_efforts[word.downcase]
|
450
|
+
level = comp_levels[word] || comp_levels[word.downcase]
|
441
451
|
if !effort
|
442
|
-
synonym_words.each
|
452
|
+
synonym_words.each do |w|
|
453
|
+
if !effort && comp_efforts[w]
|
454
|
+
effort = comp_efforts[w]
|
455
|
+
level = comp_levels[w]
|
456
|
+
end
|
457
|
+
end
|
443
458
|
end
|
444
459
|
effort ||= spelling_effort(word)
|
445
|
-
|
460
|
+
if level && level > 0 && idx > 0
|
461
|
+
effort += BOARD_CHANGE_PROCESSING_EFFORT
|
462
|
+
end
|
446
463
|
comp_effort_score += effort
|
447
464
|
end
|
448
465
|
target_effort_score = target_effort_score / words.length
|