aac-metrics 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57db00976963f424efaab981a2b5066280b2de8dd8d3b241301ba3880fe1ce5c
4
- data.tar.gz: fc386c30321ad3f94f03b00bfde72c19ea20dfebf400f6cc8322c841c5b5950b
3
+ metadata.gz: cdca6a6f1a0e5d01566d0e756115a550cbe48ec89ae0bacafb50c33070dbfd00
4
+ data.tar.gz: a86ccc6326629f57a9be59410d5768c8003141b7157b98e66337e73c98e3ae80
5
5
  SHA512:
6
- metadata.gz: 4b9778b4e5a1dce3c1571bdd3038025b7ca6acec1dc9359cc4a04c5183dfd6640fd11fc06651d3059a5561f20d5f22974e6fa35c72d6b6273ee326b38c09612b
7
- data.tar.gz: a2762f3a27e48b3445495d0ff16e46da23d80bd4d8e4a08f347df957fd3b595bc93f7697c769b92ba61bd633d57ec07b8df83c0bc2a1d374b763e48be9506724
6
+ metadata.gz: 874df2c0b4f3aeedacd81d278911c3d999a6b305e7c7754b865df3a32ae2546e0b0f7aa8c33517178ea767f12fc3383777e59a7a57d56f2571b18ce0af65034c
7
+ data.tar.gz: 297b9e01205d0154b98f898fabf5804e541a6617f0177d80e24bd31c1b8e2c81e70d8cf068f44306bc431ff43f6f1b327c267d058a82778065ec48cad652179e
@@ -252,18 +252,22 @@ module AACMetrics::Metrics
252
252
  compare = AACMetrics::Metrics.analyze(compset, false)
253
253
  res[:comp_boards] = compare[:total_boards]
254
254
  res[:comp_buttons] = compare[:total_buttons]
255
+ res[:comp_grid] = compare[:grid]
255
256
 
256
257
  compare_words = []
257
258
  compare_buttons = {}
258
259
  comp_efforts = {}
260
+ comp_levels = {}
259
261
  compare[:buttons].each do |btn|
260
262
  compare_words << btn[:label]
261
263
  compare_buttons[btn[:label]] = btn
262
264
  comp_efforts[btn[:label]] = btn[:effort]
265
+ comp_levels[btn[:label]] = btn[:level]
263
266
  end
264
267
 
265
268
  sortable_efforts = {}
266
269
  target_efforts = {}
270
+ target_levels = {}
267
271
  target_words = []
268
272
  # Track effort scores for each button in the set,
269
273
  # used to sort and for assessing priority
@@ -272,6 +276,7 @@ module AACMetrics::Metrics
272
276
  res[:buttons].each{|b|
273
277
  target_words << b[:label]
274
278
  target_efforts[b[:label]] = b[:effort]
279
+ target_levels[b[:label]] = b[:level]
275
280
  sortable_efforts[b[:label]] = b[:effort]
276
281
  comp = compare_buttons[b[:label]]
277
282
  if comp
@@ -414,7 +419,6 @@ module AACMetrics::Metrics
414
419
  res[:cores][list['id']] = {name: list['name'], list: list['words'], average_effort: list_effort, comp_effort: comp_effort}
415
420
  end
416
421
  target_effort_tally = (target_effort_tally / core_lists.to_a.length) * 5.0
417
-
418
422
  comp_effort_tally = (comp_effort_tally / core_lists.to_a.length) * 5.0
419
423
 
420
424
  # TODO: Assemble or allow a battery of word combinations,
@@ -422,27 +426,41 @@ module AACMetrics::Metrics
422
426
  # as well as an average level of effort across combinations.
423
427
  res[:sentences] = []
424
428
  sentences.each do |words|
425
- puts " #{words.join(' ')}"
426
- BOARD_CHANGE_PROCESSING_EFFORT
427
429
  target_effort_score = 0.0
428
430
  comp_effort_score = 0.0
429
431
  words.each_with_index do |word, idx|
430
432
  synonym_words = [word] + (synonyms[word] || [])
431
433
  effort = target_efforts[word] || target_efforts[word.downcase]
434
+ level = target_levels[word] || target_levels[word.downcase]
432
435
  if !effort
433
- synonym_words.each{|w| effort ||= target_efforts[w] }
436
+ synonym_words.each do |w|
437
+ if !effort && target_efforts[w]
438
+ effort = target_efforts[w]
439
+ level = target_levels[w]
440
+ end
441
+ end
434
442
  end
435
443
  effort ||= spelling_effort(word)
436
- effort += (idx == 0) ? 0.0 : BOARD_CHANGE_PROCESSING_EFFORT
444
+ if level && level > 0 && idx > 0
445
+ effort += BOARD_CHANGE_PROCESSING_EFFORT
446
+ end
437
447
  ee = effort
438
448
  target_effort_score += effort
439
449
 
440
450
  effort = comp_efforts[word] || comp_efforts[word.downcase]
451
+ level = comp_levels[word] || comp_levels[word.downcase]
441
452
  if !effort
442
- synonym_words.each{|w| effort ||= comp_efforts[w] }
453
+ synonym_words.each do |w|
454
+ if !effort && comp_efforts[w]
455
+ effort = comp_efforts[w]
456
+ level = comp_levels[w]
457
+ end
458
+ end
443
459
  end
444
460
  effort ||= spelling_effort(word)
445
- effort += (idx == 0) ? 0.0 : BOARD_CHANGE_PROCESSING_EFFORT
461
+ if level && level > 0 && idx > 0
462
+ effort += BOARD_CHANGE_PROCESSING_EFFORT
463
+ end
446
464
  comp_effort_score += effort
447
465
  end
448
466
  target_effort_score = target_effort_score / words.length