OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/translate/core/browser/translate_ranker_impl.h" | 5 #include "components/translate/core/browser/translate_ranker_impl.h" |
6 | 6 |
7 #include <initializer_list> | 7 #include <initializer_list> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 details->set_accept_ratio_weight(0.02f); | 145 details->set_accept_ratio_weight(0.02f); |
146 details->set_decline_ratio_weight(0.03f); | 146 details->set_decline_ratio_weight(0.03f); |
147 details->set_accept_count_weight(0.13f); | 147 details->set_accept_count_weight(0.13f); |
148 details->set_decline_count_weight(-0.14f); | 148 details->set_decline_count_weight(-0.14f); |
149 | 149 |
150 auto& src_language_weight = *details->mutable_source_language_weight(); | 150 auto& src_language_weight = *details->mutable_source_language_weight(); |
151 src_language_weight["en"] = 0.04f; | 151 src_language_weight["en"] = 0.04f; |
152 src_language_weight["fr"] = 0.05f; | 152 src_language_weight["fr"] = 0.05f; |
153 src_language_weight["zh"] = 0.06f; | 153 src_language_weight["zh"] = 0.06f; |
154 | 154 |
155 auto& dest_language_weight = *details->mutable_dest_language_weight(); | 155 auto& target_language_weight = *details->mutable_target_language_weight(); |
156 dest_language_weight["UNKNOWN"] = 0.00f; | 156 target_language_weight["UNKNOWN"] = 0.00f; |
157 | 157 |
158 auto& country_weight = *details->mutable_country_weight(); | 158 auto& country_weight = *details->mutable_country_weight(); |
159 country_weight["de"] = 0.07f; | 159 country_weight["de"] = 0.07f; |
160 country_weight["ca"] = 0.08f; | 160 country_weight["ca"] = 0.08f; |
161 country_weight["cn"] = 0.09f; | 161 country_weight["cn"] = 0.09f; |
162 | 162 |
163 auto& locale_weight = *details->mutable_locale_weight(); | 163 auto& locale_weight = *details->mutable_locale_weight(); |
164 locale_weight["en-us"] = 0.10f; | 164 locale_weight["en-us"] = 0.10f; |
165 locale_weight["en-ca"] = 0.11f; | 165 locale_weight["en-ca"] = 0.11f; |
166 locale_weight["zh-cn"] = 0.12f; // Normalized to lowercase. | 166 locale_weight["zh-cn"] = 0.12f; // Normalized to lowercase. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 ranker->EnableLogging(false); | 369 ranker->EnableLogging(false); |
370 | 370 |
371 ranker->AddTranslateEvent(CreateTranslateEvent("fr", "en", 1, 0, 3)); | 371 ranker->AddTranslateEvent(CreateTranslateEvent("fr", "en", 1, 0, 3)); |
372 ranker->AddTranslateEvent(CreateTranslateEvent("jp", "en", 2, 0, 3)); | 372 ranker->AddTranslateEvent(CreateTranslateEvent("jp", "en", 2, 0, 3)); |
373 ranker->AddTranslateEvent(CreateTranslateEvent("es", "de", 4, 5, 6)); | 373 ranker->AddTranslateEvent(CreateTranslateEvent("es", "de", 4, 5, 6)); |
374 | 374 |
375 // Logging is disabled, so no events should be cached. | 375 // Logging is disabled, so no events should be cached. |
376 ranker->FlushTranslateEvents(&flushed_events); | 376 ranker->FlushTranslateEvents(&flushed_events); |
377 EXPECT_EQ(0U, flushed_events.size()); | 377 EXPECT_EQ(0U, flushed_events.size()); |
378 } | 378 } |
OLD | NEW |