📄 classxapian_1_1bm25weight.tex
字号:
\hypertarget{classXapian_1_1BM25Weight}{\section{Xapian::BM25Weight Class Reference}\label{classXapian_1_1BM25Weight}\index{Xapian::BM25Weight@{Xapian::BM25Weight}}}BM25 weighting scheme. {\tt \#include $<$enquire.h$>$}Inheritance diagram for Xapian::BM25Weight:\begin{figure}[H]\begin{center}\leavevmode\includegraphics[width=76pt]{classXapian_1_1BM25Weight__inherit__graph}\end{center}\end{figure}Collaboration diagram for Xapian::BM25Weight:\begin{figure}[H]\begin{center}\leavevmode\includegraphics[width=76pt]{classXapian_1_1BM25Weight__coll__graph}\end{center}\end{figure}\subsection*{Public Member Functions}\begin{CompactItemize}\item \hyperlink{classXapian_1_1BM25Weight_a348894a51d5b8f13ebf46fd39cfbe2a}{BM25Weight} (double k1\_\-, double k2\_\-, double k3\_\-, double b\_\-, double min\_\-normlen\_\-)\begin{CompactList}\small\item\em Construct a BM25 weight. \item\end{CompactList}\item \hyperlink{classXapian_1_1BM25Weight}{BM25Weight} $\ast$ \hyperlink{classXapian_1_1BM25Weight_7b274a31997eb61c70f92418a9abc36c}{clone} () const \begin{CompactList}\small\item\em Return a new weight object of this type. \item\end{CompactList}\item std::string \hyperlink{classXapian_1_1BM25Weight_943fdc83495a97f7d6af1208f5b26052}{name} () const \begin{CompactList}\small\item\em Name of the weighting scheme. \item\end{CompactList}\item std::string \hyperlink{classXapian_1_1BM25Weight_2dd2eb60deb5690e471d68f4c7fc3203}{serialise} () const \begin{CompactList}\small\item\em Serialise object parameters into a string. \item\end{CompactList}\item \hyperlink{classXapian_1_1BM25Weight}{BM25Weight} $\ast$ \hyperlink{classXapian_1_1BM25Weight_8a9f0c48f4229aa0d62feff5f496dc78}{unserialise} (const std::string \&s) const \begin{CompactList}\small\item\em Create object given string serialisation returned by \hyperlink{classXapian_1_1BM25Weight_2dd2eb60deb5690e471d68f4c7fc3203}{serialise()}. \item\end{CompactList}\item \hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} \hyperlink{classXapian_1_1BM25Weight_6fc34658a0e0bbf6904cbef7161ba3b0}{get\_\-sumpart} (\hyperlink{types_8h_6979d98ebbe67186bd31e5ee2a7585cb}{Xapian::termcount} wdf, \hyperlink{types_8h_7272583216038f810105df7dc927723c}{Xapian::doclength} len) const \begin{CompactList}\small\item\em Get a weight which is part of the sum over terms being performed. \item\end{CompactList}\item \hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} \hyperlink{classXapian_1_1BM25Weight_f23907adc06e73cdf1228fc616a2fda2}{get\_\-maxpart} () const \begin{CompactList}\small\item\em Gets the maximum value that \hyperlink{classXapian_1_1BM25Weight_6fc34658a0e0bbf6904cbef7161ba3b0}{get\_\-sumpart()} may return. \item\end{CompactList}\item \hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} \hyperlink{classXapian_1_1BM25Weight_85644662b31656561181f26fc4e3b190}{get\_\-sumextra} (\hyperlink{types_8h_7272583216038f810105df7dc927723c}{Xapian::doclength} len) const \begin{CompactList}\small\item\em Get an extra weight for a document to add to the sum calculated over the query terms. \item\end{CompactList}\item \hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} \hyperlink{classXapian_1_1BM25Weight_7c91481891313e089eb38bf1a9a83029}{get\_\-maxextra} () const \begin{CompactList}\small\item\em Gets the maximum value that \hyperlink{classXapian_1_1BM25Weight_85644662b31656561181f26fc4e3b190}{get\_\-sumextra()} may return. \item\end{CompactList}\item bool \hyperlink{classXapian_1_1BM25Weight_0c54cede890ff405245757615d7bc651}{get\_\-sumpart\_\-needs\_\-doclength} () const \begin{CompactList}\small\item\em return false if the weight object doesn't need doclength \item\end{CompactList}\end{CompactItemize}\subsection{Detailed Description}BM25 weighting scheme. BM25 weighting options : The BM25 formula is \[ \frac{k_{2}.n_{q}}{1+L_{d}}+\sum_{t}\frac{(k_{3}+1)q_{t}}{k_{3}+q_{t}}.\frac{(k_{1}+1)f_{t,d}}{k_{1}((1-b)+bL_{d})+f_{t,d}}.w_{t} \] where\begin{itemize}\item $w_{t}$ is the termweight of term t\item $f_{t,d}$ is the within document frequency of term t in document d\item $q_{t}$ is the within query frequency of term t\item $L_{d}$ is the normalised length of document d\item $n_{q}$ is the size of the query\item $k_{1}$, $k_{2}$, $k_{3}$ and $b$ are user specified parameters \end{itemize}\subsection{Constructor \& Destructor Documentation}\hypertarget{classXapian_1_1BM25Weight_a348894a51d5b8f13ebf46fd39cfbe2a}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!BM25Weight@{BM25Weight}}\index{BM25Weight@{BM25Weight}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[BM25Weight]{\setlength{\rightskip}{0pt plus 5cm}Xapian::BM25Weight::BM25Weight (double {\em k1\_\-}, double {\em k2\_\-}, double {\em k3\_\-}, double {\em b\_\-}, double {\em min\_\-normlen\_\-})\hspace{0.3cm}{\tt \mbox{[}inline\mbox{]}}}}\label{classXapian_1_1BM25Weight_a348894a51d5b8f13ebf46fd39cfbe2a}Construct a BM25 weight. \begin{Desc}\item[Parameters:]\begin{description}\item[{\em k1}]governs the importance of within document frequency. Must be $>$= 0. 0 means ignore wdf. Default is 1. \item[{\em k2}]compensation factor for the high wdf values in large documents. Must be $>$= 0. 0 means no compensation. Default is 0. \item[{\em k3}]governs the importance of within query frequency. Must be $>$= 0. 0 means ignore wqf. Default is 1. \item[{\em b}]Relative importance of within document frequency and document length. Must be $>$= 0 and $<$= 1. Default is 0.5. \item[{\em min\_\-normlen}]specifies a cutoff on the minimum value that can be used for a normalised document length - smaller values will be forced up to this cutoff. This prevents very small documents getting a huge bonus weight. Default is 0.5. \end{description}\end{Desc}\subsection{Member Function Documentation}\hypertarget{classXapian_1_1BM25Weight_7b274a31997eb61c70f92418a9abc36c}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!clone@{clone}}\index{clone@{clone}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[clone]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{classXapian_1_1BM25Weight}{BM25Weight}$\ast$ Xapian::BM25Weight::clone () const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_7b274a31997eb61c70f92418a9abc36c}Return a new weight object of this type. A subclass called Foo\-Weight taking parameters param1 and param2 should implement this as:virtual Foo\-Weight $\ast$ \hyperlink{classXapian_1_1BM25Weight_7b274a31997eb61c70f92418a9abc36c}{clone() const} \{ return new Foo\-Weight(param1, param2); \} Implements \hyperlink{classXapian_1_1Weight}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_7c91481891313e089eb38bf1a9a83029}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!get_maxextra@{get\_\-maxextra}}\index{get_maxextra@{get\_\-maxextra}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[get\_\-maxextra]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} Xapian::BM25Weight::get\_\-maxextra () const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_7c91481891313e089eb38bf1a9a83029}Gets the maximum value that \hyperlink{classXapian_1_1BM25Weight_85644662b31656561181f26fc4e3b190}{get\_\-sumextra()} may return. This is used in optimising searches. Implements \hyperlink{classXapian_1_1Weight_ca641ecc2f5645666820f864d243f46d}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_f23907adc06e73cdf1228fc616a2fda2}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!get_maxpart@{get\_\-maxpart}}\index{get_maxpart@{get\_\-maxpart}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[get\_\-maxpart]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} Xapian::BM25Weight::get\_\-maxpart () const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_f23907adc06e73cdf1228fc616a2fda2}Gets the maximum value that \hyperlink{classXapian_1_1BM25Weight_6fc34658a0e0bbf6904cbef7161ba3b0}{get\_\-sumpart()} may return. This is used in optimising searches, by having the postlist tree decay appropriately when parts of it can have limited, or no, further effect. Implements \hyperlink{classXapian_1_1Weight_f37e797fa12bb915f73b20b953a132b7}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_85644662b31656561181f26fc4e3b190}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!get_sumextra@{get\_\-sumextra}}\index{get_sumextra@{get\_\-sumextra}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[get\_\-sumextra]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} Xapian::BM25Weight::get\_\-sumextra (\hyperlink{types_8h_7272583216038f810105df7dc927723c}{Xapian::doclength} {\em len}) const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_85644662b31656561181f26fc4e3b190}Get an extra weight for a document to add to the sum calculated over the query terms. This returns a weight for a given document, and is used by some weighting schemes to account for influence such as document length.\begin{Desc}\item[Parameters:]\begin{description}\item[{\em len}]the (unnormalised) document length. \end{description}\end{Desc}Implements \hyperlink{classXapian_1_1Weight_5b39302405b8d10911b26d796ba3f430}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_6fc34658a0e0bbf6904cbef7161ba3b0}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!get_sumpart@{get\_\-sumpart}}\index{get_sumpart@{get\_\-sumpart}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[get\_\-sumpart]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} Xapian::BM25Weight::get\_\-sumpart (\hyperlink{types_8h_6979d98ebbe67186bd31e5ee2a7585cb}{Xapian::termcount} {\em wdf}, \hyperlink{types_8h_7272583216038f810105df7dc927723c}{Xapian::doclength} {\em len}) const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_6fc34658a0e0bbf6904cbef7161ba3b0}Get a weight which is part of the sum over terms being performed. This returns a weight for a given term and document. These weights are summed to give a total weight for the document.\begin{Desc}\item[Parameters:]\begin{description}\item[{\em wdf}]the within document frequency of the term. \item[{\em len}]the (unnormalised) document length. \end{description}\end{Desc}Implements \hyperlink{classXapian_1_1Weight_cf94e6ef70e95adf04c70fee3f3c965b}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_0c54cede890ff405245757615d7bc651}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!get_sumpart_needs_doclength@{get\_\-sumpart\_\-needs\_\-doclength}}\index{get_sumpart_needs_doclength@{get\_\-sumpart\_\-needs\_\-doclength}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[get\_\-sumpart\_\-needs\_\-doclength]{\setlength{\rightskip}{0pt plus 5cm}bool Xapian::BM25Weight::get\_\-sumpart\_\-needs\_\-doclength () const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_0c54cede890ff405245757615d7bc651}return false if the weight object doesn't need doclength Reimplemented from \hyperlink{classXapian_1_1Weight_11a52ff08a2277bb765d579bf0ab77d8}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_943fdc83495a97f7d6af1208f5b26052}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!name@{name}}\index{name@{name}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[name]{\setlength{\rightskip}{0pt plus 5cm}std::string Xapian::BM25Weight::name () const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_943fdc83495a97f7d6af1208f5b26052}Name of the weighting scheme. If the subclass is called Foo\-Weight, this should return \char`\"{}Foo\char`\"{}. Implements \hyperlink{classXapian_1_1Weight_10f2a94ec786e68633012c41ecedc123}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_2dd2eb60deb5690e471d68f4c7fc3203}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!serialise@{serialise}}\index{serialise@{serialise}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[serialise]{\setlength{\rightskip}{0pt plus 5cm}std::string Xapian::BM25Weight::serialise () const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_2dd2eb60deb5690e471d68f4c7fc3203}Serialise object parameters into a string. Implements \hyperlink{classXapian_1_1Weight_a395a7cb4abd4ae0a3acc8b7d2510620}{Xapian::Weight}.\hypertarget{classXapian_1_1BM25Weight_8a9f0c48f4229aa0d62feff5f496dc78}{\index{Xapian::BM25Weight@{Xapian::BM25Weight}!unserialise@{unserialise}}\index{unserialise@{unserialise}!Xapian::BM25Weight@{Xapian::BM25Weight}}\subsubsection[unserialise]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{classXapian_1_1BM25Weight}{BM25Weight}$\ast$ Xapian::BM25Weight::unserialise (const std::string \& {\em s}) const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}}\label{classXapian_1_1BM25Weight_8a9f0c48f4229aa0d62feff5f496dc78}Create object given string serialisation returned by \hyperlink{classXapian_1_1BM25Weight_2dd2eb60deb5690e471d68f4c7fc3203}{serialise()}. Implements \hyperlink{classXapian_1_1Weight_c7406de40d11ffa4ef044d641a458484}{Xapian::Weight}.The documentation for this class was generated from the following file:\begin{CompactItemize}\item include/xapian/\hyperlink{enquire_8h}{enquire.h}\end{CompactItemize}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -