OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ |
6 #define CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ | 6 #define CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 const WordStarts& word_starts, | 80 const WordStarts& word_starts, |
81 size_t start_pos, | 81 size_t start_pos, |
82 size_t end_pos); | 82 size_t end_pos); |
83 | 83 |
84 private: | 84 private: |
85 friend class ScoredHistoryMatchTest; | 85 friend class ScoredHistoryMatchTest; |
86 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringBookmarks); | 86 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringBookmarks); |
87 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringDiscountFrecency); | 87 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringDiscountFrecency); |
88 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringScheme); | 88 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringScheme); |
89 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringTLD); | 89 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, ScoringTLD); |
90 FRIEND_TEST_ALL_PREFIXES(ScoredHistoryMatchTest, GetFinalRelevancyScore); | |
Bart N.
2015/02/10 01:22:29
Sort?
Ashok vardhan
2015/02/10 23:57:45
Acknowledged.
| |
90 | 91 |
91 // The number of days of recency scores to precompute. | 92 // The number of days of recency scores to precompute. |
92 static const int kDaysToPrecomputeRecencyScoresFor; | 93 static const int kDaysToPrecomputeRecencyScoresFor; |
93 | 94 |
94 // The number of raw term score buckets use; raw term scores | 95 // The number of raw term score buckets use; raw term scores |
95 // greater this are capped at the score of the largest bucket. | 96 // greater this are capped at the score of the largest bucket. |
96 static const int kMaxRawTermScore; | 97 static const int kMaxRawTermScore; |
97 | 98 |
98 // Return a topicality score based on how many matches appear in the | 99 // Return a topicality score based on how many matches appear in the |
99 // url and the page's title and where they are (e.g., at word | 100 // url and the page's title and where they are (e.g., at word |
(...skipping 21 matching lines...) Expand all Loading... | |
121 // better) based the rate of visits, whether the page is bookmarked, and | 122 // better) based the rate of visits, whether the page is bookmarked, and |
122 // how often those visits are typed navigations (i.e., explicitly | 123 // how often those visits are typed navigations (i.e., explicitly |
123 // invoked by the user). |now| is passed in to avoid unnecessarily | 124 // invoked by the user). |now| is passed in to avoid unnecessarily |
124 // recomputing it frequently. | 125 // recomputing it frequently. |
125 static float GetFrequency(const base::Time& now, | 126 static float GetFrequency(const base::Time& now, |
126 const bool bookmarked, | 127 const bool bookmarked, |
127 const VisitInfoVector& visits); | 128 const VisitInfoVector& visits); |
128 | 129 |
129 // Combines the two component scores into a final score that's | 130 // Combines the two component scores into a final score that's |
130 // an appropriate value to use as a relevancy score. | 131 // an appropriate value to use as a relevancy score. |
131 static float GetFinalRelevancyScore( | 132 static float GetFinalRelevancyScore(float topicality_score, |
132 float topicality_score, | 133 float frequency_score, |
133 float frequency_score); | 134 std::string& hqp_relevance_buckets); |
135 | |
136 // Initializes the HQP experimental params. | |
137 // If the experimental scoring is enabled, it sets: | |
138 // | |
139 // 1. hqp_experimental to true. Default value is set to false. | |
140 // | |
141 // 2. It initializes the topicality_threshold_, and hqp_scoring from the | |
142 // finch experiment params. | |
143 // | |
144 // 3. topicality_threshold_,is used to control the topicality scoring. | |
Bart N.
2015/02/10 01:22:29
extra comma?
Ashok vardhan
2015/02/10 23:57:45
Done.
| |
145 // If topicality_threshold > 0, then URLs with topicality score < threshold, | |
146 // are given score 0. It is initalized to -1; | |
147 // | |
148 // 4. hqp_relevance_buckets, buckets that gives the mapping from | |
149 // (topicality*frequency) to the final relevance scoring. | |
150 // Please see GetFinalRelevancyScore() for more details and scoring method. | |
151 bool hqp_experimental_scoring_enabled_; | |
152 float topicality_threshold_; | |
153 std::string hqp_relevance_buckets_; | |
154 | |
155 void InitializeHQPExperimentalParams(); | |
134 | 156 |
135 // Sets |also_do_hup_like_scoring_|, | 157 // Sets |also_do_hup_like_scoring_|, |
136 // |max_assigned_score_for_non_inlineable_matches_|, |bookmark_value_|, | 158 // |max_assigned_score_for_non_inlineable_matches_|, |bookmark_value_|, |
137 // |allow_tld_matches_|, and |allow_scheme_matches_| based on the field | 159 // |allow_tld_matches_|, and |allow_scheme_matches_| based on the field |
138 // trial state. | 160 // trial state. |
139 static void Init(); | 161 static void Init(); |
140 | 162 |
141 // An interim score taking into consideration location and completeness | 163 // An interim score taking into consideration location and completeness |
142 // of the match. | 164 // of the match. |
143 int raw_score_; | 165 int raw_score_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 // matches) because if a non-inlineable match comes first than all matches | 221 // matches) because if a non-inlineable match comes first than all matches |
200 // will get demoted later in HistoryQuickProvider to non-inlineable scores. | 222 // will get demoted later in HistoryQuickProvider to non-inlineable scores. |
201 // Set to -1 to indicate no maximum score. | 223 // Set to -1 to indicate no maximum score. |
202 static int max_assigned_score_for_non_inlineable_matches_; | 224 static int max_assigned_score_for_non_inlineable_matches_; |
203 }; | 225 }; |
204 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; | 226 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; |
205 | 227 |
206 } // namespace history | 228 } // namespace history |
207 | 229 |
208 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ | 230 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ |
OLD | NEW |