Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: components/machine_intelligence/ranker_model.h

Issue 2925733002: Move ranker_model_loader to a new component. (Closed)
Patch Set: Adressing sdefresne's comments. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_ 5 #ifndef COMPONENTS_MACHINE_INTELLIGENCE_RANKER_MODEL_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_ 6 #define COMPONENTS_MACHINE_INTELLIGENCE_RANKER_MODEL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 12
13 namespace chrome_intelligence { 13 namespace machine_intelligence {
14 14
15 class RankerModelProto; 15 class RankerModelProto;
16 16
17 // Wrapper class for chrome_intelligence::TranslateRankerProto.
18 class RankerModel { 17 class RankerModel {
19 public: 18 public:
20 RankerModel(); 19 RankerModel();
21 ~RankerModel(); 20 ~RankerModel();
22 21
23 // Returns a new ranker model constructed from |data|. 22 // Returns a new ranker model constructed from |data|.
24 static std::unique_ptr<RankerModel> FromString(const std::string& data); 23 static std::unique_ptr<RankerModel> FromString(const std::string& data);
25 24
26 const RankerModelProto& proto() const { return *proto_; } 25 const RankerModelProto& proto() const { return *proto_; }
27 RankerModelProto* mutable_proto() const { return proto_.get(); } 26 RankerModelProto* mutable_proto() const { return proto_.get(); }
28 27
29 // Returns true if this ranker model has expired. 28 // Returns true if this ranker model has expired.
30 bool IsExpired() const; 29 bool IsExpired() const;
31 30
32 const std::string& GetSourceURL() const; 31 const std::string& GetSourceURL() const;
33 32
34 // Returns a serialization of this ranker model. 33 // Returns a serialization of this ranker model.
35 std::string SerializeAsString() const; 34 std::string SerializeAsString() const;
36 35
37 private: 36 private:
38 // The underlying ranker model proto. 37 // The underlying ranker model proto.
39 std::unique_ptr<RankerModelProto> proto_; 38 std::unique_ptr<RankerModelProto> proto_;
40 39
41 DISALLOW_COPY_AND_ASSIGN(RankerModel); 40 DISALLOW_COPY_AND_ASSIGN(RankerModel);
42 }; 41 };
43 42
44 } // namesapce chrome_intelligence 43 } // namespace machine_intelligence
45 44
46 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_ 45 #endif // COMPONENTS_MACHINE_INTELLIGENCE_RANKER_MODEL_H_
OLDNEW
« no previous file with comments | « components/machine_intelligence/proto/translate_ranker_model.proto ('k') | components/machine_intelligence/ranker_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698