如何设计分类器接口,不同的分类器和数据存储

How to design Classifier interface, different classifiers and data storage?

本文关键字:分类器 存储 数据 接口      更新时间:2023-10-16

我有一个类:

class TextClassifier {
public:
  void init(const std::string& file);
  TextType classify(const std::string& text) const;
private:
  HashMap<...> data_;
}

函数init将文件中的一些统计信息加载到HashMap中,函数category进行Naive Bayes分类。

我认为进行重构是个好主意,这样类的用户就可以提供不同的分类器和不同类型的DataStorage。

但我有点困,因为我不擅长设计。你能推荐一些好的设计吗?你能不能也推荐一些关于这个主题的文献?谢谢

也许您应该了解一下策略模式:http://en.wikipedia.org/wiki/Strategy_pattern