Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "classifiers.h"
- #include <memory>
- class CombinedClassifier {
- private:
- std::unique_ptr<MainClassifier> mc;
- string mc_data;
- std::unique_ptr<FastClassifier> fc;
- public:
- CombinedClassifier(const string& s1, const string& s2) {
- fc = new FastClassifier(s1);
- mc_data = s2;
- mc = nullptr;
- }
- double classify(const string& s) {
- double ans;
- try {
- ans = (*fc).classify(s);
- }
- catch (TooHardObjectException& t) {
- if (mc == nullptr) {
- mc = new MainClassifier(mc_data);
- }
- ans = (*mc).classify(s);
- }
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement