aac-metrics 0.2.3 → 0.2.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/aac-metrics/loader.rb +4 -2
- data/lib/aac-metrics/metrics.rb +29 -16
- data/lib/aac-metrics.rb +1 -1
- data/sets/ac99-3db3a9ef48.obfset +1 -1
- data/sets/base_words.en.json +1 -16
- data/sets/bl99-f7fa334245.obfset +2 -2
- data/sets/common_words.en.json +1164 -1152
- data/sets/fringe.en.json +209 -14
- data/sets/preview.html +25 -1
- data/sets/sfy-c45a81c416.common.en.obfset +9 -9
- data/sets/st63-f270ee4c31.obfset +1 -1
- data/sets/synonyms.en.json +22 -1
- data/sets/vc12-9db81b58c4.obfset +1 -1
- data/sets/wp20-163743e671.obfset +1 -1
- data/sets/wp42-f67dc6f4a9.obfset +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c78479e8589ef0dd2ef04d5c3dfb6b737bef6bad158b75ed74a932568c6d49
|
4
|
+
data.tar.gz: 4d9c893abf5454f43a27d590ce3c50690cd6216dbf7af578872b959a593deba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db902ca606e526662b375e8eff1a97f11c4f8c8dc180feb73b5a6a221d2529d7f7c1f7b3b6f16583892ced05a97247a9963cdb31be47cce5e60397826f9d8f8a
|
7
|
+
data.tar.gz: 40612b5a7af9d7609d049f886c885e2b3f3f5974a413b44dc696e7c7ae36c3a67e69517f7924f4b8f802e5e3cc56ea2ff82bde1e39af752797d1f8146223c740
|
data/lib/aac-metrics/loader.rb
CHANGED
@@ -330,6 +330,7 @@ module AACMetrics::Loader
|
|
330
330
|
path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'sets', "common_words.#{locale}.json"))
|
331
331
|
res = JSON.parse(File.read(path)) rescue nil
|
332
332
|
if !res || res['version'] != AACMetrics::VERSION || res['files'] != files
|
333
|
+
# When version changes or the file list changes, regenerate
|
333
334
|
efforts = {}
|
334
335
|
common_words = nil
|
335
336
|
common_paths.each do |path|
|
@@ -345,7 +346,8 @@ module AACMetrics::Loader
|
|
345
346
|
end
|
346
347
|
common_words -= ['']
|
347
348
|
efforts.each do |word, vals|
|
348
|
-
|
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)
|
349
351
|
efforts[word] = vals.sum.to_f / vals.length
|
350
352
|
else
|
351
353
|
efforts.delete(word)
|
@@ -401,7 +403,7 @@ module AACMetrics::Loader
|
|
401
403
|
list = JSON.parse(File.read(path))
|
402
404
|
list.each do |set|
|
403
405
|
set['categories'].each do |cat|
|
404
|
-
all_words += cat['words']
|
406
|
+
all_words += cat['words'].sort unless cat['id'] == 'aggregate'
|
405
407
|
end
|
406
408
|
end
|
407
409
|
all_words.uniq!
|
data/lib/aac-metrics/metrics.rb
CHANGED
@@ -622,11 +622,11 @@ module AACMetrics::Metrics
|
|
622
622
|
end
|
623
623
|
|
624
624
|
# Calculate the effort for the target and comp sets
|
625
|
-
effort, level = best_match(word, target_efforts, nil, synonyms)
|
625
|
+
effort, level, fallback = best_match(word, target_efforts, nil, synonyms)
|
626
626
|
reffort = effort
|
627
627
|
list_effort += effort
|
628
628
|
|
629
|
-
effort, level = best_match(word, comp_efforts, nil, synonyms)
|
629
|
+
effort, level, fallback = best_match(word, comp_efforts, nil, synonyms)
|
630
630
|
comp_effort += effort
|
631
631
|
# puts "#{word} - #{reffort.round(1)} - #{effort.round(1)}"
|
632
632
|
end
|
@@ -654,11 +654,13 @@ module AACMetrics::Metrics
|
|
654
654
|
res[:sentences] = []
|
655
655
|
sentences.each do |words|
|
656
656
|
sequence = best_combo(words, target_efforts, target_levels, synonyms)
|
657
|
-
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]
|
658
659
|
sequence = best_combo(words, comp_efforts, comp_levels, synonyms)
|
659
|
-
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]
|
660
662
|
|
661
|
-
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}
|
662
664
|
end
|
663
665
|
res[:care_components][:sentences] = res[:sentences].map{|s| s[:effort] }.sum.to_f / res[:sentences].length.to_f * 3.0
|
664
666
|
target_effort_tally += res[:care_components][:sentences]
|
@@ -666,14 +668,16 @@ module AACMetrics::Metrics
|
|
666
668
|
comp_effort_tally += res[:care_components][:comp_sentences]
|
667
669
|
|
668
670
|
res[:fringe_words] = []
|
671
|
+
res[:missing]['fringe'] = {name: "Fringe Large Possible Corpus", list: []}
|
669
672
|
fringe.each do |word|
|
670
673
|
target_effort_score = 0.0
|
671
674
|
comp_effort_score = 0.0
|
672
675
|
|
673
|
-
effort, level = best_match(word, target_efforts, nil, synonyms)
|
676
|
+
effort, level, fallback = best_match(word, target_efforts, nil, synonyms)
|
674
677
|
target_effort_score += effort
|
678
|
+
res[:missing]['fringe'][:list] << word if fallback
|
675
679
|
|
676
|
-
effort, level = best_match(word, comp_efforts, nil, synonyms)
|
680
|
+
effort, level, fallback = best_match(word, comp_efforts, nil, synonyms)
|
677
681
|
comp_effort_score += effort
|
678
682
|
res[:fringe_words] << {word: word, effort: target_effort_score, comp_effort: comp_effort_score}
|
679
683
|
end
|
@@ -683,13 +687,15 @@ module AACMetrics::Metrics
|
|
683
687
|
comp_effort_tally += res[:care_components][:comp_fringe]
|
684
688
|
|
685
689
|
res[:common_fringe_words] = []
|
690
|
+
res[:missing]['common_fringe'] = {name: "High-Use Fringe Corpus", list: []}
|
686
691
|
common_fringe.each do |word|
|
687
692
|
target_effort_score = 0.0
|
688
693
|
comp_effort_score = 0.0
|
689
|
-
effort, level = best_match(word, target_efforts, nil, synonyms)
|
694
|
+
effort, level, fallback = best_match(word, target_efforts, nil, synonyms)
|
690
695
|
target_effort_score += effort
|
696
|
+
res[:missing]['common_fringe'][:list] << word if fallback
|
691
697
|
|
692
|
-
effort, level = best_match(word, comp_efforts, nil, synonyms)
|
698
|
+
effort, level, fallback = best_match(word, comp_efforts, nil, synonyms)
|
693
699
|
comp_effort_score += effort
|
694
700
|
res[:common_fringe_words] << {word: word, effort: target_effort_score, comp_effort: comp_effort_score}
|
695
701
|
end
|
@@ -727,11 +733,16 @@ module AACMetrics::Metrics
|
|
727
733
|
end
|
728
734
|
end
|
729
735
|
end
|
736
|
+
used_fallback = false
|
737
|
+
|
730
738
|
# Fallback penalty for missing word
|
731
739
|
fallback_effort = spelling_effort(word)
|
732
|
-
|
740
|
+
if !effort || fallback_effort < effort
|
741
|
+
used_fallback = true
|
742
|
+
effort = fallback_effort
|
743
|
+
end
|
733
744
|
|
734
|
-
[effort, level || 0]
|
745
|
+
[effort, level || 0, used_fallback]
|
735
746
|
end
|
736
747
|
|
737
748
|
def self.best_combo(words, efforts, levels, synonyms)
|
@@ -755,26 +766,28 @@ module AACMetrics::Metrics
|
|
755
766
|
options << {
|
756
767
|
next_idx: idx + combo[:size],
|
757
768
|
list: option[:list] + [[combo[:partial], combo[:effort]]],
|
758
|
-
temporary_home_id: combo[:temporary_home_id]
|
769
|
+
temporary_home_id: combo[:temporary_home_id],
|
770
|
+
fallback: option[:fallback]
|
759
771
|
}
|
760
772
|
end
|
761
|
-
effort, level = best_match(words[idx], efforts, levels, synonyms)
|
773
|
+
effort, level, fallback = best_match(words[idx], efforts, levels, synonyms)
|
762
774
|
option[:temporary_home_id] = effort.instance_variable_get('@temp_home_id')
|
775
|
+
option[:fallback] = true if fallback
|
763
776
|
effort += BOARD_CHANGE_PROCESSING_EFFORT if idx > 0 && level && level > 0
|
764
777
|
if home_id
|
765
778
|
effort += BOARD_HOME_EFFORT + BOARD_CHANGE_PROCESSING_EFFORT
|
766
|
-
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)
|
767
780
|
new_home_id = other_effort.instance_variable_get('@temp_home_id') || home_id
|
768
781
|
other_effort += BOARD_CHANGE_PROCESSING_EFFORT if idx > 0 && other_level && other_level > 0
|
769
782
|
other_list = option[:list] + [[words[idx], other_effort]]
|
770
|
-
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}
|
771
784
|
end
|
772
785
|
option[:list] << [words[idx], effort]
|
773
786
|
option[:next_idx] = idx + 1
|
774
787
|
end
|
775
788
|
end
|
776
789
|
end
|
777
|
-
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]
|
778
791
|
end
|
779
792
|
|
780
793
|
# Checks if any buttons will work for multiple words in a sentence
|
data/lib/aac-metrics.rb
CHANGED
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",
|
data/sets/base_words.en.json
CHANGED
@@ -694,7 +694,6 @@
|
|
694
694
|
"ea579aa7a9": "anemone",
|
695
695
|
"f4f068e71e": "angel",
|
696
696
|
"b192bef6f9": "angel hair",
|
697
|
-
"18a7bc65cb": "angel.",
|
698
697
|
"f79ad03c84": "angelfish",
|
699
698
|
"0b0b1cd211": "angelman",
|
700
699
|
"9d0702e9cf": "anger",
|
@@ -1523,7 +1522,6 @@
|
|
1523
1522
|
"6ff47afa5d": "brown",
|
1524
1523
|
"446f8725d2": "brown sugar",
|
1525
1524
|
"73c442ef8f": "brownie",
|
1526
|
-
"dc41ad3977": "brownie.",
|
1527
1525
|
"beef876dd2": "browse",
|
1528
1526
|
"8e3f1bbb73": "browser",
|
1529
1527
|
"f5e1271d0e": "bruise",
|
@@ -1617,7 +1615,6 @@
|
|
1617
1615
|
"df3f079de6": "by",
|
1618
1616
|
"bfa99df33b": "bye",
|
1619
1617
|
"c413c15c69": "bye!",
|
1620
|
-
"803dc11589": "bye.",
|
1621
1618
|
"4a8a08f09d": "c",
|
1622
1619
|
"cfa5ef7d62": "c-section",
|
1623
1620
|
"b3188adab3": "cabbage",
|
@@ -1974,7 +1971,6 @@
|
|
1974
1971
|
"9a673db46b": "chicken parmesan",
|
1975
1972
|
"330adca824": "chicken sandwich",
|
1976
1973
|
"f5970ca52c": "chicken soup",
|
1977
|
-
"d624b81b9f": "chicken.",
|
1978
1974
|
"f720e6f2f0": "chickpeas",
|
1979
1975
|
"1b7d572653": "child",
|
1980
1976
|
"a931704b40": "child vocabulary",
|
@@ -3975,7 +3971,6 @@
|
|
3975
3971
|
"9862ca2c10": "fools",
|
3976
3972
|
"855d366471": "foosball",
|
3977
3973
|
"d8735f7489": "foot",
|
3978
|
-
"3e55155032": "foot.",
|
3979
3974
|
"37b4e2d829": "football",
|
3980
3975
|
"98c731915e": "football game",
|
3981
3976
|
"53ab9fba48": "footrest",
|
@@ -4324,7 +4319,6 @@
|
|
4324
4319
|
"ab4c946c01": "good luck",
|
4325
4320
|
"2b849500e4": "good morning",
|
4326
4321
|
"56b611281b": "good night",
|
4327
|
-
"bb90ce54cc": "good night.",
|
4328
4322
|
"69faab6268": "goodbye",
|
4329
4323
|
"1ed7834a0c": "goodbye,",
|
4330
4324
|
"836508b6b1": "goodbyes",
|
@@ -5599,7 +5593,6 @@
|
|
5599
5593
|
"c5ba5c73d9": "lately",
|
5600
5594
|
"c18788c2f2": "later",
|
5601
5595
|
"93559a4eec": "later on?",
|
5602
|
-
"3fd14da919": "later.",
|
5603
5596
|
"71ccb7a35a": "latest",
|
5604
5597
|
"28c1e37e31": "latitude",
|
5605
5598
|
"c65fce3822": "latter",
|
@@ -5689,7 +5682,6 @@
|
|
5689
5682
|
"9a31962b95": "letters",
|
5690
5683
|
"f7fde5962d": "letting",
|
5691
5684
|
"8cbd191432": "lettuce",
|
5692
|
-
"1c4ac98a4c": "lettuce.",
|
5693
5685
|
"c9e9a84892": "level",
|
5694
5686
|
"7493614e77": "leveled",
|
5695
5687
|
"99aa4f40df": "leveling",
|
@@ -6126,7 +6118,6 @@
|
|
6126
6118
|
"23cbeacdea": "mentor",
|
6127
6119
|
"8d6ab84ca2": "menu",
|
6128
6120
|
"4a4be40c96": "meow",
|
6129
|
-
"7b63177c4a": "meow.",
|
6130
6121
|
"abe10f7e5a": "mercury",
|
6131
6122
|
"65464c31b2": "merge",
|
6132
6123
|
"2ccb3dd497": "mermaid",
|
@@ -6968,7 +6959,6 @@
|
|
6968
6959
|
"4113eabc76": "orange chicken",
|
6969
6960
|
"fc0ed5f547": "orange hawkweed",
|
6970
6961
|
"8c24f146ad": "orange juice",
|
6971
|
-
"d37696261b": "orange.",
|
6972
6962
|
"91b07b3169": "oranges",
|
6973
6963
|
"65635cd7a7": "orangutan",
|
6974
6964
|
"119d6ce059": "orbit",
|
@@ -7953,7 +7943,6 @@
|
|
7953
7943
|
"ecae13117d": "read",
|
7954
7944
|
"6905b82005": "read aloud",
|
7955
7945
|
"ce5c36aa35": "read description",
|
7956
|
-
"bc01793dab": "read.",
|
7957
7946
|
"eceadc1d40": "reading",
|
7958
7947
|
"2c77c703bd": "reading comprehension",
|
7959
7948
|
"1ff0558681": "readng",
|
@@ -8438,7 +8427,6 @@
|
|
8438
8427
|
"93cdc079d2": "saving",
|
8439
8428
|
"4bfddaa41f": "savings",
|
8440
8429
|
"a07a8f8eab": "saw",
|
8441
|
-
"03ba9ae4f1": "saw.",
|
8442
8430
|
"e57ea0cf27": "saxophone",
|
8443
8431
|
"a53ff64efd": "say",
|
8444
8432
|
"07fcf417df": "say bye-bye",
|
@@ -10522,7 +10510,6 @@
|
|
10522
10510
|
"96f5c06fee": "tough",
|
10523
10511
|
"b71f39b953": "toupee",
|
10524
10512
|
"f0a4025b3b": "tour",
|
10525
|
-
"44a0cd4080": "tour.",
|
10526
10513
|
"5b8280a83c": "toured",
|
10527
10514
|
"40bd330d8f": "touring",
|
10528
10515
|
"9c0763361a": "tourist",
|
@@ -10608,7 +10595,7 @@
|
|
10608
10595
|
"58723627fc": "trial",
|
10609
10596
|
"cef44b46f1": "triangle",
|
10610
10597
|
"075cc979c7": "triangle equilateral",
|
10611
|
-
"abb24ab301": "triangle
|
10598
|
+
"abb24ab301": "triangle",
|
10612
10599
|
"c83040fe8a": "triangular",
|
10613
10600
|
"81562c03d4": "triassic",
|
10614
10601
|
"e6c008b012": "triceratops",
|
@@ -10688,7 +10675,6 @@
|
|
10688
10675
|
"13621569c0": "tunnel",
|
10689
10676
|
"ad0b1081f8": "tupperware",
|
10690
10677
|
"db77174aa3": "turkey",
|
10691
|
-
"a0c32525f7": "turkey.",
|
10692
10678
|
"7a74a6bc6f": "turkish",
|
10693
10679
|
"a850c17cba": "turn",
|
10694
10680
|
"546fa8c1ee": "turn off",
|
@@ -11540,7 +11526,6 @@
|
|
11540
11526
|
"bc14c07fbb": "yellowknife",
|
11541
11527
|
"125085a41c": "yells",
|
11542
11528
|
"a6105c0a61": "yes",
|
11543
|
-
"4f7b50bec7": "yes.",
|
11544
11529
|
"4b6ec19e9b": "yes/no\nplease/thanks",
|
11545
11530
|
"eac9e8dd85": "yesterday",
|
11546
11531
|
"1363512db5": "yesterday was",
|
data/sets/bl99-f7fa334245.obfset
CHANGED
@@ -4562,7 +4562,7 @@
|
|
4562
4562
|
},
|
4563
4563
|
{
|
4564
4564
|
"id": "btn12",
|
4565
|
-
"label": "$
|
4565
|
+
"label": "$bfa99df33b"
|
4566
4566
|
},
|
4567
4567
|
{
|
4568
4568
|
"id": "btn13",
|
@@ -17217,7 +17217,7 @@
|
|
17217
17217
|
},
|
17218
17218
|
{
|
17219
17219
|
"id": "btn34",
|
17220
|
-
"label": "$
|
17220
|
+
"label": "$8cbd191432"
|
17221
17221
|
},
|
17222
17222
|
{
|
17223
17223
|
"id": "btn35",
|