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
24 #include <xapian/letor.h>
25 #include "letor_internal.h"
27 #include "svmranker.h"
36 Letor::Letor(const Letor
& o
) : internal(o
.internal
) { }
39 Letor::operator=(const Letor
& o
)
41 internal
= o
.internal
;
45 Letor::Letor() : internal(new Letor::Internal
) { }
51 Letor::set_database(const Xapian::Database
& db
) {
52 internal
->letor_db
= db
;
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
);
66 Letor::letor_learn_model(int s
, int k
) {
67 internal
->letor_learn_model(s
, k
);
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
);
76 Letor::create_ranker(int ranker_type
) {
78 case 0: internal
->ranker
= * new SVMRanker
;
81 default: ;//cout<<"Please specify proper ranker.";