Skip to content

Instantly share code, notes, and snippets.

View ivmarkp's full-sized avatar

Vivek Pal ivmarkp

  • New Delhi, India
View GitHub Profile
@ivmarkp
ivmarkp / adhoceval_tfidf_Ptn.txt
Created August 7, 2016 13:47
Evaluation results of "'Ptn" normalization of TfIdfWeight which basically represents "Pxx" normalization string.
_______________________________________________________
Result for the run: xapiantfidf_Ptn
-----------------------------------------------------
Query wise Precision:
_______________________________________________________
50Precision of Query: 126 is : 0.02873
-----------------------------------------------------
Precision of Query: 127 is : 0.000690923
-----------------------------------------------------
Precision of Query: 128 is : 0

Running evaluations

Following are the steps to help getting started with running evaluations of inbuilt weighting schemes in Xapian, i.e. BM25, PL2, LMWeight etc. along with the new ones, i.e. BM25+, PL2+ etc.

1. Open up terminal and type :: git clone https://github.com/samuelharden/xapian-evaluation.git

@ivmarkp
ivmarkp / test.cpp
Last active February 23, 2017 18:34
Test whether using arma::max function is faster than using loops.
#include <iostream>
#include <vector>
#include <ctime>
#include <armadillo>
using namespace std;
using namespace arma;
int main() {
mat A = randu<mat>(10000,10000);
// Initialise the parameters mem, g and g2.
arma::mat mem = arma::ones<arma::mat>(iterate.n_rows, iterate.n_cols);
arma::mat g = arma::zeros<arma::mat>(iterate.n_rows, iterate.n_cols);
arma::mat g2 = arma::zeros<arma::mat>(iterate.n_rows, iterate.n_cols);
// And update the iterate.
arma::mat r = 1 / (mem + 1);
unordered_map<string, int> word_to_occurrence;
// Build map before line 755 in query.cc by calling the method build_word_map.
void build_word_map(const string& list) {
string word;
int count = 0;
for (size_t i = 0; i <= list.length(); ++i)
{
@ivmarkp
ivmarkp / omegatest.sh
Last active March 19, 2017 19:51
A testcase for $highlight{} command.
# Tests for $highlight.
printf '$highlight{$cgi{a},$cgi{b},$cgi{c},$cgi{d}}' > "$TEST_TEMPLATE"
testcase 'A list of <b>words</b>' P=text a="words" b="A list of words" c="<b>" d="</b>"
checksum@inspiron:~/Documents/xapian/build/xapian-applications/omega$ git diff
diff --git a/xapian-applications/omega/omegatest b/xapian-applications/omega/omegatest
index b8505e2cf040..d6c9d78814e4 100755
--- a/xapian-applications/omega/omegatest
+++ b/xapian-applications/omega/omegatest
@@ -302,6 +302,18 @@ testcase '.~~D' DOCIDORDER=D
testcase '.~~' DOCIDORDER=X # Buggy, but kept for compatibility.
testcase '.~~' DOCIDORDER=x # Buggy, but kept for compatibility.
+# Feature tests for $highlight{}.
@ivmarkp
ivmarkp / autoencoder.hpp
Last active March 27, 2017 10:41
Abstract class for Autoencoders
namespace mlpack {
namespace nn {
class Autoencoder {
public:
Autoencoder(const arma::mat& data,
const size_t inputSize,
const size_t hiddenSize,
NoiseLayerType&& noiseLayer = NoisetLayerType());
@ivmarkp
ivmarkp / omega.txt
Last active May 30, 2017 02:18
Setting up Omega CGI
Command: Indexing
sudo /usr/local/bin/omindex -v --db=/var/lib/omega/data/default --url=/ /var/www
Output:
[Entering directory ""]
Indexing "ci_10.htm" as text/html ... already indexed
Indexing "ci_07.htm" as text/html ... already indexed
Indexing "ci_30.htm" as text/html ... already indexed
Indexing "ci_39B.htm" as text/html ... already indexed
Indexing "ci_20.htm" as text/html ... already indexed
Indexing "ci_33.htm" as text/html ... already indexed
@ivmarkp
ivmarkp / clicklog.js
Last active June 13, 2017 23:08
Javascript to be stored as clicklogjs in the templates/inc directory.
<script type="text/javascript"><!--
function clicklog() {
// Redirect to the clicklog template with $id of the clicked document.
// We could do something like:
// window.location.assign("../clicklog")
// to redirect to the clicklog template.
// I'm not sure about how we could pass $query and the clicked doc $id to the template.
return true; // To allow following the href link in the <a> tag i.e. document url.
}
// -->