OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_DOM_DISTILLER_CORE_DISTILLABLE_PAGE_DETECTOR_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLABLE_PAGE_DETECTOR_H_ |
6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLABLE_PAGE_DETECTOR_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLABLE_PAGE_DETECTOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "components/dom_distiller/core/proto/adaboost.pb.h" | 11 #include "components/dom_distiller/core/proto/adaboost.pb.h" |
12 | 12 |
13 namespace dom_distiller { | 13 namespace dom_distiller { |
14 | 14 |
15 class DistillablePageDetector { | 15 class DistillablePageDetector { |
16 public: | 16 public: |
| 17 static const DistillablePageDetector* GetDefault(); |
17 explicit DistillablePageDetector(scoped_ptr<AdaBoostProto> proto); | 18 explicit DistillablePageDetector(scoped_ptr<AdaBoostProto> proto); |
18 ~DistillablePageDetector(); | 19 ~DistillablePageDetector(); |
19 bool Classify(const std::vector<double>& features) const; | 20 bool Classify(const std::vector<double>& features) const; |
20 double Score(const std::vector<double>& features) const; | 21 double Score(const std::vector<double>& features) const; |
21 double GetThreshold() const; | 22 double GetThreshold() const; |
22 private: | 23 private: |
23 scoped_ptr<AdaBoostProto> proto_; | 24 scoped_ptr<AdaBoostProto> proto_; |
24 double threshold_; | 25 double threshold_; |
25 DISALLOW_COPY_AND_ASSIGN(DistillablePageDetector); | 26 DISALLOW_COPY_AND_ASSIGN(DistillablePageDetector); |
26 }; | 27 }; |
27 | 28 |
28 | 29 |
29 } // namespace dom_distiller | 30 } // namespace dom_distiller |
30 | 31 |
31 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLABLE_PAGE_DETECTOR_H_ | 32 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLABLE_PAGE_DETECTOR_H_ |
OLD | NEW |