Commit b467eb8c authored by Chris Hall's avatar Chris Hall Committed by Commit Bot

Trivial: Language detection: avoid unsigned to signed conversion.

Removing usage of unsigned integer types in language detection to
comply with style guide.

R=dmazzoni,meredithl
CC=thestig

Change-Id: Ibeed71088a0ed4239f4d3c0aab8acc34b55687a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096603Reviewed-by: default avatarMeredith Lane <meredithl@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Chris Hall <chrishall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753081}
parent fbbdc289
...@@ -57,7 +57,7 @@ void AXLanguageInfoStats::Add(const std::vector<std::string>& languages) { ...@@ -57,7 +57,7 @@ void AXLanguageInfoStats::Add(const std::vector<std::string>& languages) {
// Assign languages with higher probability a higher score. // Assign languages with higher probability a higher score.
// TODO(chrishall): consider more complex scoring // TODO(chrishall): consider more complex scoring
unsigned int score = kMaxDetectedLanguagesPerSpan; int score = kMaxDetectedLanguagesPerSpan;
for (const auto& lang : languages) { for (const auto& lang : languages) {
lang_counts_[lang] += score; lang_counts_[lang] += score;
......
...@@ -150,11 +150,11 @@ class AX_EXPORT AXLanguageInfoStats { ...@@ -150,11 +150,11 @@ class AX_EXPORT AXLanguageInfoStats {
friend class AXLanguageDetectionTestFixture; friend class AXLanguageDetectionTestFixture;
// Store a count of the occurrences of a given language. // Store a count of the occurrences of a given language.
std::unordered_map<std::string, unsigned int> lang_counts_; std::unordered_map<std::string, int> lang_counts_;
// Cache of last calculated top language results. // Cache of last calculated top language results.
// A vector of pairs of (score, language) sorted by descending score. // A vector of pairs of (score, language) sorted by descending score.
std::vector<std::pair<unsigned int, std::string>> top_results_; std::vector<std::pair<int, std::string>> top_results_;
// Boolean recording that we have not mutated the statistics since last // Boolean recording that we have not mutated the statistics since last
// calculating top results, setting this to false will cause recalculation // calculating top results, setting this to false will cause recalculation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment