aac-metrics 0.2.2 → 0.2.4
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/aac-metrics/loader.rb +7 -2
- data/lib/aac-metrics/metrics.rb +33 -23
- data/sets/ac99-3db3a9ef48.obfset +1 -1
- data/sets/base_words.en.json +406 -13
- data/sets/bl99-f7fa334245.obfset +31059 -0
- data/sets/cbu-5da852dd65.obfset +1321 -0
- data/sets/cw20-2a2a04587d.obfset +12532 -0
- data/sets/cw40-b73146776d.obfset +36249 -0
- data/sets/cw6-9239957af6.obfset +2111 -0
- data/sets/cw60-a365d1821c.obfset +65562 -0
- data/sets/fringe.en.json +209 -14
- data/sets/preview.html +109 -1
- data/sets/{seq15-555e3cd10a.obfset → seq15-ce2e1c7a45.obfset} +74 -2
- data/sets/sfy-c45a81c416.common.en.obfset +9 -9
- data/sets/st63-f270ee4c31.obfset +17432 -0
- data/sets/synonyms.en.json +21 -1
- data/sets/vc12-9db81b58c4.obfset +1 -1
- data/sets/wp20-163743e671.obfset +1 -1
- data/sets/wp42-f67dc6f4a9.obfset +1 -1
- metadata +10 -4
- data/sets/cbu-2ae9aef211.obfset +0 -372
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 177d88edba43f47e65e7080652f63cb7405056e7ba8d1d7f50e415082ecbecb9
|
4
|
+
data.tar.gz: 0420f4f6af64452a82a5546d35b99240771094389c9fdb88938ccd862803ac03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c28f80c87ca6e0a151913f4c6637b76d54e5b8658afb415c2ae3a9062289cc2d958e28f9108dfd7750723bbf3a15826555e48c44453f9ba049ce6e65955803a9
|
7
|
+
data.tar.gz: 8601390c7d6e9f78ab69157e71a0d4bab67dae0af250c5068a03b71108113ba17b815ec588d34554126ee1b264a8fbc07c8a86c17b3f59da96a16389b604c1a9
|
data/lib/aac-metrics/loader.rb
CHANGED
@@ -187,7 +187,10 @@ module AACMetrics::Loader
|
|
187
187
|
puts "Link found with no access #{btn['load_board'].to_json}"
|
188
188
|
end
|
189
189
|
new_btn['load_board']['temporary_home'] = true if new_btn['load_board'] && btn['load_board']['temporary_home']
|
190
|
+
new_btn['load_board']['temporary_home'] = true if new_btn['load_board'] && btn['ext_coughdrop_home_lock']
|
190
191
|
new_btn['load_board']['add_to_sentence'] = true if new_btn['load_board'] && btn['load_board']['add_to_sentence']
|
192
|
+
new_btn['load_board']['add_to_sentence'] = true if new_btn['load_board'] && btn['ext_coughdrop_add_to_vocalization']
|
193
|
+
new_btn['load_board']['add_to_sentence'] = true if new_btn['load_board'] && btn['ext_coughdrop_add_vocalization']
|
191
194
|
elsif btn['action']
|
192
195
|
# TODO: track keyboard actions and don't
|
193
196
|
# treat action buttons for metrics
|
@@ -327,6 +330,7 @@ module AACMetrics::Loader
|
|
327
330
|
path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'sets', "common_words.#{locale}.json"))
|
328
331
|
res = JSON.parse(File.read(path)) rescue nil
|
329
332
|
if !res || res['version'] != AACMetrics::VERSION || res['files'] != files
|
333
|
+
# When version changes or the file list changes, regenerate
|
330
334
|
efforts = {}
|
331
335
|
common_words = nil
|
332
336
|
common_paths.each do |path|
|
@@ -342,7 +346,8 @@ module AACMetrics::Loader
|
|
342
346
|
end
|
343
347
|
common_words -= ['']
|
344
348
|
efforts.each do |word, vals|
|
345
|
-
|
349
|
+
# If a word is in 80% of the common vocabs, include it in the list
|
350
|
+
if vals.length >= (common_paths.length * 0.8)
|
346
351
|
efforts[word] = vals.sum.to_f / vals.length
|
347
352
|
else
|
348
353
|
efforts.delete(word)
|
@@ -398,7 +403,7 @@ module AACMetrics::Loader
|
|
398
403
|
list = JSON.parse(File.read(path))
|
399
404
|
list.each do |set|
|
400
405
|
set['categories'].each do |cat|
|
401
|
-
all_words += cat['words']
|
406
|
+
all_words += cat['words'].sort unless cat['id'] == 'aggregate'
|
402
407
|
end
|
403
408
|
end
|
404
409
|
all_words.uniq!
|
data/lib/aac-metrics/metrics.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
# TODO:
|
2
2
|
# Qualitative evaluation criteria:
|
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
3
|
# - this set provides clear locations for user-specific words to be added
|
7
4
|
# - this set supports the use of grammatical forms (tenses and other inflections)
|
8
5
|
# - 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
6
|
|
13
7
|
# Effort algorithms for scanning/eyes
|
14
8
|
module AACMetrics::Metrics
|
@@ -139,7 +133,8 @@ module AACMetrics::Metrics
|
|
139
133
|
analysis_version: AACMetrics::VERSION,
|
140
134
|
locale: locale,
|
141
135
|
total_boards: total_boards,
|
142
|
-
total_buttons: buttons.
|
136
|
+
total_buttons: buttons.map{|b| b[:count] || 1}.sum,
|
137
|
+
total_words: buttons.map{|b| b[:label] }.uniq.length,
|
143
138
|
reference_counts: set_refs,
|
144
139
|
grid: {
|
145
140
|
rows: root_rows,
|
@@ -360,6 +355,7 @@ module AACMetrics::Metrics
|
|
360
355
|
label: word,
|
361
356
|
level: board[:level],
|
362
357
|
effort: effort,
|
358
|
+
count: ((existing || {})[:count] || 0) + 1
|
363
359
|
}
|
364
360
|
# If a board set has any temporary_home links,
|
365
361
|
# then that can possibly affect the effort
|
@@ -458,6 +454,7 @@ module AACMetrics::Metrics
|
|
458
454
|
compare = AACMetrics::Metrics.analyze(compset, false)
|
459
455
|
res[:comp_boards] = compare[:total_boards]
|
460
456
|
res[:comp_buttons] = compare[:total_buttons]
|
457
|
+
res[:comp_words] = compare[:total_words]
|
461
458
|
res[:comp_grid] = compare[:grid]
|
462
459
|
|
463
460
|
compare_words = []
|
@@ -625,11 +622,11 @@ module AACMetrics::Metrics
|
|
625
622
|
end
|
626
623
|
|
627
624
|
# Calculate the effort for the target and comp sets
|
628
|
-
effort, level = best_match(word, target_efforts, nil, synonyms)
|
625
|
+
effort, level, fallback = best_match(word, target_efforts, nil, synonyms)
|
629
626
|
reffort = effort
|
630
627
|
list_effort += effort
|
631
628
|
|
632
|
-
effort, level = best_match(word, comp_efforts, nil, synonyms)
|
629
|
+
effort, level, fallback = best_match(word, comp_efforts, nil, synonyms)
|
633
630
|
comp_effort += effort
|
634
631
|
# puts "#{word} - #{reffort.round(1)} - #{effort.round(1)}"
|
635
632
|
end
|
@@ -657,11 +654,13 @@ module AACMetrics::Metrics
|
|
657
654
|
res[:sentences] = []
|
658
655
|
sentences.each do |words|
|
659
656
|
sequence = best_combo(words, target_efforts, target_levels, synonyms)
|
660
|
-
target_effort_score = sequence.map{|w, e| e }.sum.to_f / words.length.to_f
|
657
|
+
target_effort_score = sequence[:list].map{|w, e| e }.sum.to_f / words.length.to_f
|
658
|
+
typing = sequence[:fallback]
|
661
659
|
sequence = best_combo(words, comp_efforts, comp_levels, synonyms)
|
662
|
-
comp_effort_score = sequence.map{|w, e| e }.sum.to_f / words.length.to_f
|
660
|
+
comp_effort_score = sequence[:list].map{|w, e| e }.sum.to_f / words.length.to_f
|
661
|
+
comp_typing = sequence[:fallback]
|
663
662
|
|
664
|
-
res[:sentences] << {sentence: words.join(' '), words: words, effort: target_effort_score, comp_effort: comp_effort_score}
|
663
|
+
res[:sentences] << {sentence: words.join(' '), words: words, effort: target_effort_score, typing: typing, comp_effort: comp_effort_score, comp_typing: comp_typing}
|
665
664
|
end
|
666
665
|
res[:care_components][:sentences] = res[:sentences].map{|s| s[:effort] }.sum.to_f / res[:sentences].length.to_f * 3.0
|
667
666
|
target_effort_tally += res[:care_components][:sentences]
|
@@ -669,14 +668,16 @@ module AACMetrics::Metrics
|
|
669
668
|
comp_effort_tally += res[:care_components][:comp_sentences]
|
670
669
|
|
671
670
|
res[:fringe_words] = []
|
671
|
+
res[:missing]['fringe'] = {name: "Fringe Large Possible Corpus", list: []}
|
672
672
|
fringe.each do |word|
|
673
673
|
target_effort_score = 0.0
|
674
674
|
comp_effort_score = 0.0
|
675
675
|
|
676
|
-
effort, level = best_match(word, target_efforts, nil, synonyms)
|
676
|
+
effort, level, fallback = best_match(word, target_efforts, nil, synonyms)
|
677
677
|
target_effort_score += effort
|
678
|
+
res[:missing]['fringe'][:list] << word if fallback
|
678
679
|
|
679
|
-
effort, level = best_match(word, comp_efforts, nil, synonyms)
|
680
|
+
effort, level, fallback = best_match(word, comp_efforts, nil, synonyms)
|
680
681
|
comp_effort_score += effort
|
681
682
|
res[:fringe_words] << {word: word, effort: target_effort_score, comp_effort: comp_effort_score}
|
682
683
|
end
|
@@ -686,13 +687,15 @@ module AACMetrics::Metrics
|
|
686
687
|
comp_effort_tally += res[:care_components][:comp_fringe]
|
687
688
|
|
688
689
|
res[:common_fringe_words] = []
|
690
|
+
res[:missing]['common_fringe'] = {name: "High-Use Fringe Corpus", list: []}
|
689
691
|
common_fringe.each do |word|
|
690
692
|
target_effort_score = 0.0
|
691
693
|
comp_effort_score = 0.0
|
692
|
-
effort, level = best_match(word, target_efforts, nil, synonyms)
|
694
|
+
effort, level, fallback = best_match(word, target_efforts, nil, synonyms)
|
693
695
|
target_effort_score += effort
|
696
|
+
res[:missing]['common_fringe'][:list] << word if fallback
|
694
697
|
|
695
|
-
effort, level = best_match(word, comp_efforts, nil, synonyms)
|
698
|
+
effort, level, fallback = best_match(word, comp_efforts, nil, synonyms)
|
696
699
|
comp_effort_score += effort
|
697
700
|
res[:common_fringe_words] << {word: word, effort: target_effort_score, comp_effort: comp_effort_score}
|
698
701
|
end
|
@@ -730,11 +733,16 @@ module AACMetrics::Metrics
|
|
730
733
|
end
|
731
734
|
end
|
732
735
|
end
|
736
|
+
used_fallback = false
|
737
|
+
|
733
738
|
# Fallback penalty for missing word
|
734
739
|
fallback_effort = spelling_effort(word)
|
735
|
-
|
740
|
+
if !effort || fallback_effort < effort
|
741
|
+
used_fallback = true
|
742
|
+
effort = fallback_effort
|
743
|
+
end
|
736
744
|
|
737
|
-
[effort, level || 0]
|
745
|
+
[effort, level || 0, used_fallback]
|
738
746
|
end
|
739
747
|
|
740
748
|
def self.best_combo(words, efforts, levels, synonyms)
|
@@ -758,26 +766,28 @@ module AACMetrics::Metrics
|
|
758
766
|
options << {
|
759
767
|
next_idx: idx + combo[:size],
|
760
768
|
list: option[:list] + [[combo[:partial], combo[:effort]]],
|
761
|
-
temporary_home_id: combo[:temporary_home_id]
|
769
|
+
temporary_home_id: combo[:temporary_home_id],
|
770
|
+
fallback: option[:fallback]
|
762
771
|
}
|
763
772
|
end
|
764
|
-
effort, level = best_match(words[idx], efforts, levels, synonyms)
|
773
|
+
effort, level, fallback = best_match(words[idx], efforts, levels, synonyms)
|
765
774
|
option[:temporary_home_id] = effort.instance_variable_get('@temp_home_id')
|
775
|
+
option[:fallback] = true if fallback
|
766
776
|
effort += BOARD_CHANGE_PROCESSING_EFFORT if idx > 0 && level && level > 0
|
767
777
|
if home_id
|
768
778
|
effort += BOARD_HOME_EFFORT + BOARD_CHANGE_PROCESSING_EFFORT
|
769
|
-
other_effort, other_level = best_match(words[idx], efforts["H:#{home_id}"] || {}, levels["H:#{home_id}"] || {}, synonyms)
|
779
|
+
other_effort, other_level, other_fallback = best_match(words[idx], efforts["H:#{home_id}"] || {}, levels["H:#{home_id}"] || {}, synonyms)
|
770
780
|
new_home_id = other_effort.instance_variable_get('@temp_home_id') || home_id
|
771
781
|
other_effort += BOARD_CHANGE_PROCESSING_EFFORT if idx > 0 && other_level && other_level > 0
|
772
782
|
other_list = option[:list] + [[words[idx], other_effort]]
|
773
|
-
options << {next_idx: idx + 1, list: other_list, temporary_home_id: new_home_id}
|
783
|
+
options << {next_idx: idx + 1, list: other_list, temporary_home_id: new_home_id, fallback: option[:fallback] || other_fallback}
|
774
784
|
end
|
775
785
|
option[:list] << [words[idx], effort]
|
776
786
|
option[:next_idx] = idx + 1
|
777
787
|
end
|
778
788
|
end
|
779
789
|
end
|
780
|
-
options.sort_by{|o| o[:list].map{|w, e| e}.sum }.reverse[0]
|
790
|
+
options.sort_by{|o| o[:list].map{|w, e| e}.sum }.reverse[0]
|
781
791
|
end
|
782
792
|
|
783
793
|
# Checks if any buttons will work for multiple words in a sentence
|
data/sets/ac99-3db3a9ef48.obfset
CHANGED
@@ -87509,7 +87509,7 @@
|
|
87509
87509
|
},
|
87510
87510
|
{
|
87511
87511
|
"id": "btn10",
|
87512
|
-
"label": "$
|
87512
|
+
"label": "$c18788c2f2"
|
87513
87513
|
},
|
87514
87514
|
{
|
87515
87515
|
"id": "btn11",
|