aac-metrics 0.1.8 → 0.2.0
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/loader.rb +11 -2
- data/lib/aac-metrics/metrics.rb +45 -12
- data/sets/common_words.en.json +1426 -1424
- data/sets/fringe.en.json +12 -129
- data/sets/l84f-e9fafa55d4.common.en.analysis +27620 -27480
- data/sets/l84f-e9fafa55d4.common.en.obfset +14784 -4752
- 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: 62c96e82e12b2a0c9eb03ad38b65af63c348731faf58ac3920de4d87c77e2d1c
|
4
|
+
data.tar.gz: 16c049e5e33c1b18cdb374afbf9117299fd47bddc91c15042284f2f41f96dc6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c37bef0e90cbea57f8e0d860e2751c1508028b97b9c76e669c6a9f33d5921dc7cf34ea819249c744c7e30a0e08aa9ebb9e9c4bc19fbacc85e56f1ebd7121a9df
|
7
|
+
data.tar.gz: bf47f7d0bbe809195ad6576269532e0ed4b26cae918ae605b671e6c562fcfdf1e5fba892bd7e0c936a18082b8a9c291c0bfec75a44eb9b9ec3f320e1bec1e52f
|
data/lib/aac-metrics/loader.rb
CHANGED
@@ -391,9 +391,18 @@ module AACMetrics::Loader
|
|
391
391
|
end
|
392
392
|
end
|
393
393
|
all_words.uniq!
|
394
|
-
@@
|
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]
|
data/lib/aac-metrics/metrics.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# TODO:
|
2
2
|
# Qualitative evaluation criteria:
|
3
|
-
# - this set
|
4
|
-
# - this set
|
5
|
-
# -
|
6
|
-
# - this set provides clear
|
7
|
-
# - grammatical forms
|
8
|
-
# -
|
9
|
-
# -
|
10
|
-
# -
|
11
|
-
# -
|
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
|
-
|
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
|
-
|
604
|
-
|
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
|
|