aac-metrics 0.1.8 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 554fc52ede0b5dffdcf9315ec279a9f42a3ef2a44a324195018eda56538336b1
4
- data.tar.gz: 2b082df38edf52ddf495045969db894ef02f7718641658d8d1ca4b012456e14c
3
+ metadata.gz: 62c96e82e12b2a0c9eb03ad38b65af63c348731faf58ac3920de4d87c77e2d1c
4
+ data.tar.gz: 16c049e5e33c1b18cdb374afbf9117299fd47bddc91c15042284f2f41f96dc6b
5
5
  SHA512:
6
- metadata.gz: 58c3c7e8128b0bee8754baa3b218a36491cf985ed752b917733a0508bc9a4c8abe8c3e2c40ddcb7cd9098bea51a6c3d9143f5ba4cbd2d9098f59f16899bf1e0b
7
- data.tar.gz: c9e2ec540feee357aaf6b1a20b11e5b938d2f4f8d28ba6d03eee80245167b1eb339ab5a2e1440588db6a31cffbe27bee37a44d6ef35f0078f5381d363c06226c
6
+ metadata.gz: c37bef0e90cbea57f8e0d860e2751c1508028b97b9c76e669c6a9f33d5921dc7cf34ea819249c744c7e30a0e08aa9ebb9e9c4bc19fbacc85e56f1ebd7121a9df
7
+ data.tar.gz: bf47f7d0bbe809195ad6576269532e0ed4b26cae918ae605b671e6c562fcfdf1e5fba892bd7e0c936a18082b8a9c291c0bfec75a44eb9b9ec3f320e1bec1e52f
@@ -391,9 +391,18 @@ module AACMetrics::Loader
391
391
  end
392
392
  end
393
393
  all_words.uniq!
394
- @@synonyms[locale] = all_words
394
+ @@fringe_words[locale] = all_words
395
395
  end
396
-
396
+
397
+ def self.common_fringe_words(locale)
398
+ @@common_fringe_words ||= {}
399
+ return @@common_fringe_words[locale] if @@common_fringe_words[locale]
400
+ common = self.common_words(locale)['words']
401
+ core = self.core_lists('en').map{|r| r['words'] }.flatten.compact.uniq
402
+ all_words = common - core
403
+ @@common_fringe_words[locale] = all_words
404
+ end
405
+
397
406
  def self.base_words(locale)
398
407
  @@base_words ||= {}
399
408
  return @@base_words[locale] if @@base_words[locale]
@@ -1,14 +1,14 @@
1
1
  # TODO:
2
2
  # Qualitative evaluation criteria:
3
- # - this set is easy to learn for communicators
4
- # - this set is easy to learn for supporters
5
- # - the vocabulary organization of this set makes sense
6
- # - this set provides clear opportunities for user-specific words to be added
7
- # - grammatical forms, growth over time
8
- # - works well for age group X, Y, Z
9
- # - works well for a beginning communicator
10
- # - allows long-term growth as-is
11
- # - comprehensive core
3
+ # - this set looks easy to learn for communicators
4
+ # - this set looks easy to learn for supporters
5
+ # - this vocabulary organization of this set makes sense
6
+ # - this set provides clear locations for user-specific words to be added
7
+ # - this set supports the use of grammatical forms (tenses and other inflections)
8
+ # - this set provides predefined simplification for beginning communicators
9
+ # - this set allows for long-term vocabulary growth over time
10
+ # - this vocabulary looks like it will work well for young users
11
+ # - this vocabulary looks like it will work well for adult users
12
12
 
13
13
  # Effort algorithms for scanning/eyes
14
14
  module AACMetrics::Metrics
@@ -54,6 +54,7 @@ module AACMetrics::Metrics
54
54
  visited_board_ids = {}
55
55
  to_visit = [{board: obfset[0], level: 0, entry_x: 1.0, entry_y: 1.0}]
56
56
  set_refs = {}
57
+ cell_refs = {}
57
58
  rows_tally = 0.0
58
59
  cols_tally = 0.0
59
60
  root_rows = nil
@@ -73,6 +74,13 @@ module AACMetrics::Metrics
73
74
  set_refs[id] += 1
74
75
  end
75
76
  end
77
+ board['grid']['rows'].times do |row_idx|
78
+ board['grid']['columns'].times do |col_idx|
79
+ id = (board['grid']['order'][row_idx] || [])[col_idx]
80
+ cell_refs["#{row_idx}.#{col_idx}"] ||= 0.0
81
+ cell_refs["#{row_idx}.#{col_idx}"] += id ? 1.0 : 0.25
82
+ end
83
+ end
76
84
  if board['semantic_ids']
77
85
  board['semantic_ids'].each do |id|
78
86
  set_refs[id] ||= 0
@@ -88,7 +96,8 @@ module AACMetrics::Metrics
88
96
  end
89
97
  set_pcts = {}
90
98
  set_refs.each do |id, cnt|
91
- set_pcts[id] = cnt.to_f / obfset.length.to_f
99
+ loc = id.split(/-/)[1]
100
+ set_pcts[id] = cnt.to_f / (cell_refs[loc] || obfset.length).to_f
92
101
  end
93
102
  locale = obfset[0]['locale']
94
103
  known_buttons = {}
@@ -407,6 +416,7 @@ module AACMetrics::Metrics
407
416
  synonyms = AACMetrics::Loader.synonyms(target[:locale])
408
417
  sentences = AACMetrics::Loader.sentences(target[:locale])
409
418
  fringe = AACMetrics::Loader.fringe_words(target[:locale])
419
+ common_fringe = AACMetrics::Loader.common_fringe_words(target[:locale])
410
420
  common_words_obj['efforts'].each{|w, e| sortable_efforts[w] ||= e }
411
421
  common_words = common_words_obj['words']
412
422
 
@@ -600,8 +610,31 @@ module AACMetrics::Metrics
600
610
  target_effort_tally += res[:fringe_words].map{|s| s[:effort] }.sum.to_f / res[:fringe_words].length.to_f * 2.0
601
611
  comp_effort_tally += res[:fringe_words].map{|s| s[:comp_effort] }.sum.to_f / res[:fringe_words].length.to_f * 2.0
602
612
 
603
- target_effort_tally += 80 # placeholder value for future added calculations
604
- comp_effort_tally += 80
613
+ res[:common_fringe_words] = []
614
+ common_fringe.each do |word|
615
+ target_effort_score = 0.0
616
+ comp_effort_score = 0.0
617
+ synonym_words = [word] + (synonyms[word] || [])
618
+ effort = target_efforts[word] || target_efforts[word.downcase]
619
+ if !effort
620
+ synonym_words.each{|w| effort ||= target_efforts[w] }
621
+ end
622
+ effort ||= spelling_effort(word)
623
+ target_effort_score += effort
624
+
625
+ effort = comp_efforts[word] || comp_efforts[word.downcase]
626
+ if !effort
627
+ synonym_words.each{|w| effort ||= comp_efforts[w] }
628
+ end
629
+ effort ||= spelling_effort(word)
630
+ comp_effort_score += effort
631
+ res[:common_fringe_words] << {word: word, effort: target_effort_score, comp_effort: comp_effort_score}
632
+ end
633
+ target_effort_tally += res[:common_fringe_words].map{|s| s[:effort] }.sum.to_f / res[:common_fringe_words].length.to_f * 1.0
634
+ comp_effort_tally += res[:common_fringe_words].map{|s| s[:comp_effort] }.sum.to_f / res[:common_fringe_words].length.to_f * 1.0
635
+
636
+ target_effort_tally += 70 # placeholder value for future added calculations
637
+ comp_effort_tally += 70
605
638
 
606
639
 
607
640