Skip to content

Commit

Permalink
Merge pull request github-linguist#873 from github/debug
Browse files Browse the repository at this point in the history
fix refactoring from github-linguist#836
  • Loading branch information
tnm committed Dec 29, 2013
2 parents bbf0e65 + bd4204b commit 9dc7329
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/linguist/classifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def classify(tokens, languages)
debug_dump_all_tokens(tokens, languages) if verbosity >= 2

languages.each do |language|
debug_dump_probabilities(tokens, language) if verbosity >= 1
scores[language] = tokens_probability(tokens, language) + language_probability(language)
debug_dump_probabilities(tokens, language, scores[language]) if verbosity >= 1
end

scores.sort { |a, b| b[1] <=> a[1] }.map { |score| [score[0], score[1]] }
Expand Down Expand Up @@ -130,9 +130,9 @@ def verbosity
@verbosity ||= (ENV['LINGUIST_DEBUG'] || 0).to_i
end

def debug_dump_probabilities(tokens, language)
def debug_dump_probabilities(tokens, language, score)
printf("%10s = %10.3f + %7.3f = %10.3f\n",
language, tokens_probability(tokens, language), language_probability(language), scores[language])
language, tokens_probability(tokens, language), language_probability(language), score)
end

# Internal: show a table of probabilities for each <token,language> pair.
Expand Down

0 comments on commit 9dc7329

Please sign in to comment.