lib/quarry/src/model/model.cpp in thera-0.0.2 vs lib/quarry/src/model/model.cpp in thera-0.0.3
- old
+ new
@@ -4,9 +4,18 @@
}
void Model::Model::train_text(string text) {
}
+DataSet::Example *Model::Model::process_text(string text, bool create_features) {
+ return text_pipeline->process_text((DataSet::SparseDataSet *)data_set, (char *)text.c_str(), create_features);
+}
+
+void Model::Model::add_text_example(string text, string category) {
+ DataSet::Example *example = text_pipeline->process_text((DataSet::SparseDataSet *)data_set, (char *)text.c_str(), true);
+ example->set_category_index(data_set, data_set->category_feature()->value_index(category));
+}
+
int Model::Model::classify(DataSet::Example *example) {
return classifier->classify(example);
}
int Model::Model::classify_text(string text) {