Fix smoketest.lua to work with newer lua
[xapian.git] / xapian-letor / letor_features.h
blob6c8947bca8db5858c08b1eb3394598c5638b562d
1 /* letor_features.h: The feature manager file.
3 * Copyright (C) 2012 Parth Gupta
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18 * USA
21 #ifndef LETOR_FEATURES_H
22 #define LETOR_FEATURES_H
24 #include <xapian/letor.h>
26 #include <list>
27 #include <map>
29 using namespace std;
32 namespace Xapian {
34 class XAPIAN_VISIBILITY_DEFAULT Features {
35 public:
37 map<string,long int> termfreq(const Xapian::Document & doc,const Xapian::Query & query);
39 map<string,double> inverse_doc_freq(const Xapian::Database & db, const Xapian::Query & query);
41 map<string,long int> doc_length(const Xapian::Database & db, const Xapian::Document & doc);
43 map<string,long int> collection_length(const Xapian::Database & db);
45 map<string,long int> collection_termfreq(const Xapian::Database & db, const Xapian::Query & query);
47 double calculate_f1(const Xapian::Query & query, map<string,long int> & tf,char ch);
49 double calculate_f2(const Xapian::Query & query, map<string,long int> & tf, map<string,long int> & doc_length, char ch);
51 double calculate_f3(const Xapian::Query & query, map<string,double> & idf, char ch);
53 double calculate_f4(const Xapian::Query & query, map<string,long int> & tf, map<string,long int> & coll_len, char ch);
55 double calculate_f5(const Xapian::Query & query, map<string,long int> & tf, map<string,double> & idf, map<string,long int> & doc_length,char ch);
57 double calculate_f6(const Xapian::Query & query, map<string,long int> & tf, map<string,long int> & doc_length,map<string,long int> & coll_tf, map<string,long int> & coll_length, char ch);
64 #endif /* FEATURES_H */