{"action":"created","comment":{"url":"https://api.github.com/repos/xapian/xapian/pulls/comments/75823785","id":75823785,"diff_hunk":"@@ -0,0 +1,146 @@\n+/** @file trainletor.cc\n+ * @brief Command line tool to prepare Letor training file and train the model\n+ */\n+/* Copyright (C) 2004,2005,2006,2007,2008,2009,2010,2015 Olly Betts\n+ * Copyright (C) 2011 Parth Gupta\n+ * Copyright (C) 2016 Ayush Tomar\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU General Public License as\n+ * published by the Free Software Foundation; either version 2 of the\n+ * License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, write to the Free Software\n+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n+ * USA\n+ */\n+\n+#include <config.h>\n+\n+#include <xapian.h>\n+#include <xapian-letor.h>\n+\n+#include <cstdlib>\n+#include <cstring>\n+#include <stdio.h>\n+#include <stdlib.h>\n+\n+#include <iostream>\n+#include <fstream>\n+#include <sstream>\n+#include <string>\n+#include <map>\n+#include <set>\n+#include <math.h>\n+\n+#include \"gnu_getopt.h\"\n+\n+using namespace std;\n+\n+#define PROG_NAME \"letor-train\"\n+#define PROG_DESC \"Command line tool to prepare letor training file and train the model\"\n+\n+static void show_usage() {\n+    cout << \"Usage: \" PROG_NAME \" [OPTIONS]\\n\"\n+\"Options:\\n\"\n+\"  --db=DIRECTORY  database to search (multiple databases may be specified)\\n\"\n+\"  --query=PATH  path to query file\\n\"\n+\"  --qrel=PATH  path to qrel file\\n\"\n+\"  --msize=MSIZE   maximum number of matches to return\\n\"\n+\"  --train=PATH  path to file by which training file is to be saved\\n\"\n+\"  --model=PATH  path to file by training file is to be saved\\n\"\n+\"  --help          display this help and exit\\n\"\n+\"  --version       output version information and exit\\n\";\n+}\n+\n+int\n+main(int argc, char **argv)\n+try {\n+    const char * opts = \"a:b:c:d:e:f:g:h\";","path":"xapian-letor/bin/trainletor.cc","position":65,"original_position":65,"commit_id":"5a4042a3ec631f42bcb1e693b415f20faeb915ed","original_commit_id":"0dd91c678ae6b81174ff147a6601e59631e096f8","user":{"login":"ojwb","id":164061,"avatar_url":"https://avatars.githubusercontent.com/u/164061?v=3","gravatar_id":"","url":"https://api.github.com/users/ojwb","html_url":"https://github.com/ojwb","followers_url":"https://api.github.com/users/ojwb/followers","following_url":"https://api.github.com/users/ojwb/following{/other_user}","gists_url":"https://api.github.com/users/ojwb/gists{/gist_id}","starred_url":"https://api.github.com/users/ojwb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojwb/subscriptions","organizations_url":"https://api.github.com/users/ojwb/orgs","repos_url":"https://api.github.com/users/ojwb/repos","events_url":"https://api.github.com/users/ojwb/events{/privacy}","received_events_url":"https://api.github.com/users/ojwb/received_events","type":"User","site_admin":false},"body":"It's also very frustrating when short options aren't consistent, especially within a codebase.  Consistency makes complex systems much easier to learn and to remember.\r\n\r\nFor example, in Xapian we use `-d` as the short option for `--db` consistently.  Imagine how annoying it would be if one program used `-d` for something else (especially if it was short for something like `--delete-database`!)\r\n\r\nIt's similarly annoying when long options aren't consistent (e.g. `--db` in some places, `--database` in others).\r\n\r\nSo where an option is already present in another program, use the same long and short names.  And try to avoid picking new short names for a program that are used elsewhere for an option which might make sense to add to this program.\r\n\r\nAlso, there's no requirement to have a short option for everything.  If an option is dangerous or very rarely used, it may make sense to not allocate a short option for it.\r\n\r\nActually, I notice `quest` has `-v` for `--version` which we generally use for `--verbose`, and `quest` could sensibly have a `--verbose` option one day.  Please don't copy that mistake to here!","created_at":"2016-08-23T08:41:27Z","updated_at":"2016-08-23T08:41:27Z","html_url":"https://github.com/xapian/xapian/pull/123#discussion_r75823785","pull_request_url":"https://api.github.com/repos/xapian/xapian/pulls/123","_links":{"self":{"href":"https://api.github.com/repos/xapian/xapian/pulls/comments/75823785"},"html":{"href":"https://github.com/xapian/xapian/pull/123#discussion_r75823785"},"pull_request":{"href":"https://api.github.com/repos/xapian/xapian/pulls/123"}}},"pull_request":{"url":"https://api.github.com/repos/xapian/xapian/pulls/123","id":81674549,"html_url":"https://github.com/xapian/xapian/pull/123","diff_url":"https://github.com/xapian/xapian/pull/123.diff","patch_url":"https://github.com/xapian/xapian/pull/123.patch","issue_url":"https://api.github.com/repos/xapian/xapian/issues/123","number":123,"state":"open","locked":false,"title":"letor: Integrate ListNET and NDCGScore","user":{"login":"ayshtmr","id":6681897,"avatar_url":"https://avatars.githubusercontent.com/u/6681897?v=3","gravatar_id":"","url":"https://api.github.com/users/ayshtmr","html_url":"https://github.com/ayshtmr","followers_url":"https://api.github.com/users/ayshtmr/followers","following_url":"https://api.github.com/users/ayshtmr/following{/other_user}","gists_url":"https://api.github.com/users/ayshtmr/gists{/gist_id}","starred_url":"https://api.github.com/users/ayshtmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayshtmr/subscriptions","organizations_url":"https://api.github.com/users/ayshtmr/orgs","repos_url":"https://api.github.com/users/ayshtmr/repos","events_url":"https://api.github.com/users/ayshtmr/events{/privacy}","received_events_url":"https://api.github.com/users/ayshtmr/received_events","type":"User","site_admin":false},"body":"This PR does the following:\r\n1. Integrate `ListNETRanker`.\r\n2. Integrate `NDCGScore`\r\n3. `Letor` class updates for `ListNetRanker` and `NDCGScore`\r\n4. Update `questletor.cc` and add `trainletor.cc` in `/bin`\r\n5. Update `letor.rst`\r\n\r\nThis PR will put xapian-letor in a useable state. Exception handling and automated tests will follow next.","created_at":"2016-08-17T16:28:31Z","updated_at":"2016-08-23T08:41:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e1b7ded0f132e4acb4643c23aa68b611108087c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/xapian/xapian/pulls/123/commits","review_comments_url":"https://api.github.com/repos/xapian/xapian/pulls/123/comments","review_comment_url":"https://api.github.com/repos/xapian/xapian/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xapian/xapian/issues/123/comments","statuses_url":"https://api.github.com/repos/xapian/xapian/statuses/5a4042a3ec631f42bcb1e693b415f20faeb915ed","head":{"label":"ayshtmr:ndcg-listnet","ref":"ndcg-listnet","sha":"5a4042a3ec631f42bcb1e693b415f20faeb915ed","user":{"login":"ayshtmr","id":6681897,"avatar_url":"https://avatars.githubusercontent.com/u/6681897?v=3","gravatar_id":"","url":"https://api.github.com/users/ayshtmr","html_url":"https://github.com/ayshtmr","followers_url":"https://api.github.com/users/ayshtmr/followers","following_url":"https://api.github.com/users/ayshtmr/following{/other_user}","gists_url":"https://api.github.com/users/ayshtmr/gists{/gist_id}","starred_url":"https://api.github.com/users/ayshtmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayshtmr/subscriptions","organizations_url":"https://api.github.com/users/ayshtmr/orgs","repos_url":"https://api.github.com/users/ayshtmr/repos","events_url":"https://api.github.com/users/ayshtmr/events{/privacy}","received_events_url":"https://api.github.com/users/ayshtmr/received_events","type":"User","site_admin":false},"repo":{"id":53319064,"name":"xapian","full_name":"ayshtmr/xapian","owner":{"login":"ayshtmr","id":6681897,"avatar_url":"https://avatars.githubusercontent.com/u/6681897?v=3","gravatar_id":"","url":"https://api.github.com/users/ayshtmr","html_url":"https://github.com/ayshtmr","followers_url":"https://api.github.com/users/ayshtmr/followers","following_url":"https://api.github.com/users/ayshtmr/following{/other_user}","gists_url":"https://api.github.com/users/ayshtmr/gists{/gist_id}","starred_url":"https://api.github.com/users/ayshtmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayshtmr/subscriptions","organizations_url":"https://api.github.com/users/ayshtmr/orgs","repos_url":"https://api.github.com/users/ayshtmr/repos","events_url":"https://api.github.com/users/ayshtmr/events{/privacy}","received_events_url":"https://api.github.com/users/ayshtmr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ayshtmr/xapian","description":"Mirror of the Xapian repository.  You're welcome to open pull requests on github (they'll just get merged indirectly).","fork":true,"url":"https://api.github.com/repos/ayshtmr/xapian","forks_url":"https://api.github.com/repos/ayshtmr/xapian/forks","keys_url":"https://api.github.com/repos/ayshtmr/xapian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ayshtmr/xapian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ayshtmr/xapian/teams","hooks_url":"https://api.github.com/repos/ayshtmr/xapian/hooks","issue_events_url":"https://api.github.com/repos/ayshtmr/xapian/issues/events{/number}","events_url":"https://api.github.com/repos/ayshtmr/xapian/events","assignees_url":"https://api.github.com/repos/ayshtmr/xapian/assignees{/user}","branches_url":"https://api.github.com/repos/ayshtmr/xapian/branches{/branch}","tags_url":"https://api.github.com/repos/ayshtmr/xapian/tags","blobs_url":"https://api.github.com/repos/ayshtmr/xapian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ayshtmr/xapian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ayshtmr/xapian/git/refs{/sha}","trees_url":"https://api.github.com/repos/ayshtmr/xapian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ayshtmr/xapian/statuses/{sha}","languages_url":"https://api.github.com/repos/ayshtmr/xapian/languages","stargazers_url":"https://api.github.com/repos/ayshtmr/xapian/stargazers","contributors_url":"https://api.github.com/repos/ayshtmr/xapian/contributors","subscribers_url":"https://api.github.com/repos/ayshtmr/xapian/subscribers","subscription_url":"https://api.github.com/repos/ayshtmr/xapian/subscription","commits_url":"https://api.github.com/repos/ayshtmr/xapian/commits{/sha}","git_commits_url":"https://api.github.com/repos/ayshtmr/xapian/git/commits{/sha}","comments_url":"https://api.github.com/repos/ayshtmr/xapian/comments{/number}","issue_comment_url":"https://api.github.com/repos/ayshtmr/xapian/issues/comments{/number}","contents_url":"https://api.github.com/repos/ayshtmr/xapian/contents/{+path}","compare_url":"https://api.github.com/repos/ayshtmr/xapian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ayshtmr/xapian/merges","archive_url":"https://api.github.com/repos/ayshtmr/xapian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ayshtmr/xapian/downloads","issues_url":"https://api.github.com/repos/ayshtmr/xapian/issues{/number}","pulls_url":"https://api.github.com/repos/ayshtmr/xapian/pulls{/number}","milestones_url":"https://api.github.com/repos/ayshtmr/xapian/milestones{/number}","notifications_url":"https://api.github.com/repos/ayshtmr/xapian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ayshtmr/xapian/labels{/name}","releases_url":"https://api.github.com/repos/ayshtmr/xapian/releases{/id}","deployments_url":"https://api.github.com/repos/ayshtmr/xapian/deployments","created_at":"2016-03-07T11:06:41Z","updated_at":"2016-03-07T11:06:47Z","pushed_at":"2016-08-23T07:07:00Z","git_url":"git://github.com/ayshtmr/xapian.git","ssh_url":"git@github.com:ayshtmr/xapian.git","clone_url":"https://github.com/ayshtmr/xapian.git","svn_url":"https://github.com/ayshtmr/xapian","homepage":"https://xapian.org/","size":75456,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xapian:master","ref":"master","sha":"42994909650c71f6095009cbc40ed04c8087e7c7","user":{"login":"xapian","id":312861,"avatar_url":"https://avatars.githubusercontent.com/u/312861?v=3","gravatar_id":"","url":"https://api.github.com/users/xapian","html_url":"https://github.com/xapian","followers_url":"https://api.github.com/users/xapian/followers","following_url":"https://api.github.com/users/xapian/following{/other_user}","gists_url":"https://api.github.com/users/xapian/gists{/gist_id}","starred_url":"https://api.github.com/users/xapian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xapian/subscriptions","organizations_url":"https://api.github.com/users/xapian/orgs","repos_url":"https://api.github.com/users/xapian/repos","events_url":"https://api.github.com/users/xapian/events{/privacy}","received_events_url":"https://api.github.com/users/xapian/received_events","type":"Organization","site_admin":false},"repo":{"id":735981,"name":"xapian","full_name":"xapian/xapian","owner":{"login":"xapian","id":312861,"avatar_url":"https://avatars.githubusercontent.com/u/312861?v=3","gravatar_id":"","url":"https://api.github.com/users/xapian","html_url":"https://github.com/xapian","followers_url":"https://api.github.com/users/xapian/followers","following_url":"https://api.github.com/users/xapian/following{/other_user}","gists_url":"https://api.github.com/users/xapian/gists{/gist_id}","starred_url":"https://api.github.com/users/xapian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xapian/subscriptions","organizations_url":"https://api.github.com/users/xapian/orgs","repos_url":"https://api.github.com/users/xapian/repos","events_url":"https://api.github.com/users/xapian/events{/privacy}","received_events_url":"https://api.github.com/users/xapian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xapian/xapian","description":"Mirror of the Xapian repository.  You're welcome to open pull requests on github (they'll just get merged indirectly).","fork":false,"url":"https://api.github.com/repos/xapian/xapian","forks_url":"https://api.github.com/repos/xapian/xapian/forks","keys_url":"https://api.github.com/repos/xapian/xapian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xapian/xapian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xapian/xapian/teams","hooks_url":"https://api.github.com/repos/xapian/xapian/hooks","issue_events_url":"https://api.github.com/repos/xapian/xapian/issues/events{/number}","events_url":"https://api.github.com/repos/xapian/xapian/events","assignees_url":"https://api.github.com/repos/xapian/xapian/assignees{/user}","branches_url":"https://api.github.com/repos/xapian/xapian/branches{/branch}","tags_url":"https://api.github.com/repos/xapian/xapian/tags","blobs_url":"https://api.github.com/repos/xapian/xapian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xapian/xapian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xapian/xapian/git/refs{/sha}","trees_url":"https://api.github.com/repos/xapian/xapian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xapian/xapian/statuses/{sha}","languages_url":"https://api.github.com/repos/xapian/xapian/languages","stargazers_url":"https://api.github.com/repos/xapian/xapian/stargazers","contributors_url":"https://api.github.com/repos/xapian/xapian/contributors","subscribers_url":"https://api.github.com/repos/xapian/xapian/subscribers","subscription_url":"https://api.github.com/repos/xapian/xapian/subscription","commits_url":"https://api.github.com/repos/xapian/xapian/commits{/sha}","git_commits_url":"https://api.github.com/repos/xapian/xapian/git/commits{/sha}","comments_url":"https://api.github.com/repos/xapian/xapian/comments{/number}","issue_comment_url":"https://api.github.com/repos/xapian/xapian/issues/comments{/number}","contents_url":"https://api.github.com/repos/xapian/xapian/contents/{+path}","compare_url":"https://api.github.com/repos/xapian/xapian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xapian/xapian/merges","archive_url":"https://api.github.com/repos/xapian/xapian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xapian/xapian/downloads","issues_url":"https://api.github.com/repos/xapian/xapian/issues{/number}","pulls_url":"https://api.github.com/repos/xapian/xapian/pulls{/number}","milestones_url":"https://api.github.com/repos/xapian/xapian/milestones{/number}","notifications_url":"https://api.github.com/repos/xapian/xapian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xapian/xapian/labels{/name}","releases_url":"https://api.github.com/repos/xapian/xapian/releases{/id}","deployments_url":"https://api.github.com/repos/xapian/xapian/deployments","created_at":"2010-06-23T15:51:03Z","updated_at":"2016-08-22T07:09:54Z","pushed_at":"2016-08-23T07:45:27Z","git_url":"git://github.com/xapian/xapian.git","ssh_url":"git@github.com:xapian/xapian.git","clone_url":"https://github.com/xapian/xapian.git","svn_url":"https://github.com/xapian/xapian","homepage":"https://xapian.org/","size":87307,"stargazers_count":275,"watchers_count":275,"language":"C++","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":147,"mirror_url":null,"open_issues_count":19,"forks":147,"open_issues":19,"watchers":275,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xapian/xapian/pulls/123"},"html":{"href":"https://github.com/xapian/xapian/pull/123"},"issue":{"href":"https://api.github.com/repos/xapian/xapian/issues/123"},"comments":{"href":"https://api.github.com/repos/xapian/xapian/issues/123/comments"},"review_comments":{"href":"https://api.github.com/repos/xapian/xapian/pulls/123/comments"},"review_comment":{"href":"https://api.github.com/repos/xapian/xapian/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xapian/xapian/pulls/123/commits"},"statuses":{"href":"https://api.github.com/repos/xapian/xapian/statuses/5a4042a3ec631f42bcb1e693b415f20faeb915ed"}}}}
{"actor":{"display_login":"ojwb"}}