typedef pair<ModelIdentifier::Model,double> modelpair;
+struct ScoreCmp {
+ template<typename T>
+ bool operator()(T s1, T s2){
+ return s1.first < s2.first;
+ }
+};
+
int main(int argc, char** argv){
string ann = "default.ann";
//TODO: Identify
ModelIdentifier mi(ann);
map<ModelIdentifier::Model,double> scores = mi.identify(go);
+ priority_queue<pair<double,ModelIdentifier::Model>,vector<pair<double,ModelIdentifier::Model> >, ScoreCmp > pq;
for (map<ModelIdentifier::Model,double>::iterator m = scores.begin();
m != scores.end(); ++m){
- cout << "Model: " << m->first << " score: " << m->second << endl;
+ if (m->second > 0){
+ pq.push(pair<double,ModelIdentifier::Model>(m->second,m->first));
+ }
+ }
+ while (pq.size() > 0){
+ cout << "Model: " << mi.modelName(pq.top().second) << " score: " << pq.top().first << endl;
+ pq.pop();
}
//TODO: Chose a sorter
scores[Cloud] = output[4];
return scores;
}
+
+string ModelIdentifier::modelName(Model m){
+ switch (m){
+ case Whirl : return "Whirl";
+ case X : return "X";
+ case FatX : return "FatX";
+ case Zipper : return "Zipper";
+ case Cloud : return "Cloud";
+ }
+ return "Unknown model";
+}