aac-metrics 0.1.0 → 0.1.1
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/metrics.rb +50 -2
- 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: 24e65891d54936aeecfeab18e673f39e27c8d85ed71131658118bf0764502dd6
|
4
|
+
data.tar.gz: f3eea991fad67e0445a52462a96e5af2f7e72737464c22883e80222926f2dd16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 433769c391cb7039957b338c6263ad8c0c107b8e2c67f3bfe7e4e30276816290c859bad7add69bdb06ed58e88d25fc9400cd89dd9791b600d028f023483ff8f9
|
7
|
+
data.tar.gz: cdb2251cfa3d2531ffb2fa8b8cff28b0dc9902b19c8f83a43c8faa641981f92ad7cb1655c86d4b6f510df907ad41546fa63bfdd0475cebb41330348110a20ca2
|
data/lib/aac-metrics/metrics.rb
CHANGED
@@ -130,18 +130,24 @@ module AACMetrics::Metrics
|
|
130
130
|
res = {}.merge(target)
|
131
131
|
|
132
132
|
compare = AACMetrics::Metrics.analyze(compset, false)
|
133
|
+
res[:comp_boards] = compare[:total_boards]
|
134
|
+
res[:comp_buttons] = compare[:total_buttons]
|
133
135
|
|
134
136
|
compare_words = []
|
135
137
|
compare_buttons = {}
|
138
|
+
comp_efforts = {}
|
136
139
|
compare[:buttons].each do |btn|
|
137
140
|
compare_words << btn[:label]
|
138
141
|
compare_buttons[btn[:label]] = btn
|
142
|
+
comp_efforts[btn[:label]] = btn[:effort]
|
139
143
|
end
|
140
144
|
|
141
145
|
efforts = {}
|
146
|
+
target_efforts = {}
|
142
147
|
target_words = []
|
143
148
|
res[:buttons].each{|b|
|
144
149
|
target_words << b[:label]
|
150
|
+
target_efforts[b[:label]] = b[:effort]
|
145
151
|
efforts[b[:label]] = b[:effort]
|
146
152
|
comp = compare_buttons[b[:label]]
|
147
153
|
if comp
|
@@ -199,26 +205,68 @@ module AACMetrics::Metrics
|
|
199
205
|
missing = missing.select do |word|
|
200
206
|
!synonyms[word] || (synonyms[word] & target_words).length == 0
|
201
207
|
end
|
208
|
+
common_effort = 0
|
209
|
+
comp_effort = 0
|
210
|
+
common_words.each do |word|
|
211
|
+
effort = target_efforts[word]
|
212
|
+
if !effort && synonyms[word]
|
213
|
+
synonyms[word].each do |syn|
|
214
|
+
effort ||= target_efforts[syn]
|
215
|
+
end
|
216
|
+
end
|
217
|
+
effort ||= 2 + (word.length * 2.5)
|
218
|
+
common_effort += effort
|
219
|
+
|
220
|
+
effort = comp_efforts[word]
|
221
|
+
if !effort && synonyms[word]
|
222
|
+
synonyms[word].each do |syn|
|
223
|
+
effort ||= comp_efforts[syn]
|
224
|
+
end
|
225
|
+
end
|
226
|
+
effort ||= 2 + (word.length * 2.5)
|
227
|
+
comp_effort += effort
|
228
|
+
end
|
229
|
+
common_effort = common_effort.to_f / common_words.length.to_f
|
230
|
+
comp_effort = comp_effort.to_f / common_words.length.to_f
|
202
231
|
# puts "MISSING FROM COMMON (#{missing.length})"
|
203
232
|
res[:missing] = {
|
204
233
|
:common => {name: "Common Word List", list: missing}
|
205
234
|
}
|
235
|
+
res[:cores] = {
|
236
|
+
:common => {name: "Common Word List", list: common_words, average_effort: common_effort, comp_effort: comp_effort}
|
237
|
+
}
|
206
238
|
# puts missing.join(' ')
|
207
239
|
core_lists.each do |list|
|
208
240
|
puts list['id']
|
209
241
|
missing = []
|
242
|
+
list_effort = 0
|
243
|
+
comp_effort = 0
|
210
244
|
list['words'].each do |word|
|
211
245
|
words = [word] + (synonyms[word] || [])
|
212
246
|
if (target_words & words).length == 0
|
213
247
|
missing << word
|
214
|
-
raise "orng" if word == 'orange'
|
215
248
|
end
|
249
|
+
effort = target_efforts[word]
|
250
|
+
if !effort
|
251
|
+
words.each{|w| effort ||= target_efforts[w] }
|
252
|
+
end
|
253
|
+
effort ||= 2 + (word.length * 2.5)
|
254
|
+
list_effort += effort
|
255
|
+
effort = comp_efforts[word]
|
256
|
+
if !effort
|
257
|
+
words.each{|w| effort ||= comp_efforts[w] }
|
258
|
+
end
|
259
|
+
effort ||= 2 + (word.length * 2.5)
|
260
|
+
comp_effort += effort
|
216
261
|
end
|
217
262
|
if missing.length > 0
|
218
263
|
# puts "MISSING FROM #{list['id']} (#{missing.length}):"
|
219
|
-
res[:missing][list['id']] = {name: list['name'], list: missing}
|
264
|
+
res[:missing][list['id']] = {name: list['name'], list: missing, average_effort: list_effort}
|
220
265
|
# puts missing.join(' ')
|
221
266
|
end
|
267
|
+
list_effort = list_effort.to_f / list['words'].length.to_f
|
268
|
+
comp_effort = comp_effort.to_f / list['words'].length.to_f
|
269
|
+
res[:cores][list['id']] = {name: list['name'], list: list['words'], average_effort: list_effort, comp_effort: comp_effort}
|
222
270
|
end
|
223
271
|
# puts "CONSIDER MAKING EASIER"
|
224
272
|
res[:high_effort_words] = too_hard
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aac-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Whitmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|