From 333368cd7313076b003f97ef36fa2fc5cefc857b Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 22 Jul 2019 15:30:33 -0500 Subject: [PATCH] fix bug in lexical richness --- app/services/documents/analysis/counting_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/documents/analysis/counting_service.rb b/app/services/documents/analysis/counting_service.rb index e9f50957..f35ad43a 100644 --- a/app/services/documents/analysis/counting_service.rb +++ b/app/services/documents/analysis/counting_service.rb @@ -22,12 +22,12 @@ module Documents # Word reuse -- there's probably a WAY better way to compute this, but # I guess speed isn't priority #1 when you're async anyway. We should # definitely audit memory usage here though. - analysis.words_used_once_count = document.words + analysis.words_used_repeatedly_count = document.words .select { |word| document.words.rindex(word) != document.words.index(word) } .uniq .count - analysis.words_used_repeatedly_count = analysis.word_count - analysis.words_used_once_count + analysis.words_used_once_count = analysis.word_count - analysis.words_used_repeatedly_count # Complexity counters analysis.complex_words_count = document.complex_words.count