# File lib/language_detector.rb, line 160 def compute_distance(other_profile) distance = 0 other_profile.ngrams.each do |k, v| n = @ngrams[k] if n = @ngrams[k] distance += (v - n).abs else distance += LIMIT end end distance end