Improve @param docs for Database::compact()
[xapian.git] / xapian-letor / letor.cc
blob9c75b7e1108cc125338d3f713ac8f6d8eeabda36
1 /** @file letor.cc
2 * @brief Letor Class
3 */
4 /* Copyright (C) 2011 Parth Gupta
5 * Copyright (C) 2012 Olly Betts
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20 * USA
23 #include <config.h>
24 #include <xapian/letor.h>
25 #include "letor_internal.h"
26 #include "ranker.h"
27 #include "svmranker.h"
29 #include <map>
30 #include <string>
32 using namespace std;
34 namespace Xapian {
36 Letor::Letor(const Letor & o) : internal(o.internal) { }
38 Letor &
39 Letor::operator=(const Letor & o)
41 internal = o.internal;
42 return *this;
45 Letor::Letor() : internal(new Letor::Internal) { }
47 Letor::~Letor() { }
50 void
51 Letor::set_database(const Xapian::Database & db) {
52 internal->letor_db = db;
55 void
56 Letor::set_query(const Xapian::Query & query) {
57 internal->letor_query = query;
60 map<Xapian::docid, double>
61 Letor::letor_score(const Xapian::MSet & mset) {
62 return internal->letor_score(mset);
65 void
66 Letor::letor_learn_model(int s, int k) {
67 internal->letor_learn_model(s, k);
70 void
71 Letor::prepare_training_file(const string & query_file, const string & qrel_file, Xapian::doccount msetsize) {
72 internal->prepare_training_file(query_file, qrel_file, msetsize);
75 void
76 Letor::create_ranker(int ranker_type) {
77 switch(ranker_type) {
78 case 0: internal->ranker = * new SVMRanker;
79 break;
80 case 1: break;
81 default: ;//cout<<"Please specify proper ranker.";