2 * @brief Description of Feature class
4 /* Copyright (C) 2016 Ayush Tomar
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24 #include "xapian-letor/feature.h"
29 Feature::Feature() : stats_needed()
31 LOGCALL_CTOR(API
, "Feature", NO_ARGS
);
35 LOGCALL_DTOR(API
, "Feature");
39 Feature::set_database(const Xapian::Database
& db
)
41 LOGCALL_VOID(API
, "Feature::set_database", db
);
46 Feature::set_query(const Xapian::Query
& query
)
48 LOGCALL_VOID(API
, "Feature::set_query", query
);
49 feature_query
= query
;
53 Feature::set_doc(const Xapian::Document
& doc
)
55 LOGCALL_VOID(API
, "Feature::set_doc", doc
);
60 Feature::set_termfreq(const std::map
<std::string
, Xapian::termcount
> & tf
)
62 LOGCALL_VOID(API
, "Feature::set_termfreq", tf
);
67 Feature::set_inverse_doc_freq(const std::map
<std::string
, double> & idf
)
69 LOGCALL_VOID(API
, "Feature::set_inverse_doc_freq", idf
);
70 inverse_doc_freq
= idf
;
74 Feature::set_doc_length(const std::map
<std::string
,
75 Xapian::termcount
> & doc_len
)
77 LOGCALL_VOID(API
, "Feature::set_doc_length", doc_len
);
82 Feature::set_collection_length(const std::map
<std::string
,
83 Xapian::termcount
> & collection_len
)
85 LOGCALL_VOID(API
, "Feature::set_collection_length", collection_len
);
86 collection_length
= collection_len
;
90 Feature::set_collection_termfreq(const std::map
<std::string
,
91 Xapian::termcount
> &collection_tf
)
93 LOGCALL_VOID(API
, "Feature::set_collection_termfreq", collection_tf
);
94 collection_termfreq
= collection_tf
;