{"action":"created","comment":{"url":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/comments/94075220","pull_request_review_id":14605809,"id":94075220,"diff_hunk":"@@ -0,0 +1,233 @@\n+#include \"rnnlm/rnnlm-utils.h\"\n+\n+namespace kaldi {\n+namespace rnnlm {\n+\n+vector<string> SplitByWhiteSpace(const string &line) {\n+  std::stringstream ss(line);\n+  vector<string> ans;\n+  string word;\n+  while (ss >> word) {\n+    ans.push_back(word);\n+  }\n+  return ans;\n+}\n+\n+unordered_map<string, int> ReadWordlist(string filename) {\n+  unordered_map<string, int> ans;\n+  ifstream ifile(filename.c_str());\n+  string word;\n+  int id;\n+\n+  while (ifile >> word >> id) {\n+    ans[word] = id;\n+  }\n+  return ans;\n+}\n+\n+NnetExample GetEgsFromSent(const vector<int>& word_ids_in, int input_dim,\n+                           const vector<int>& word_ids_out, int output_dim) {\n+  SparseMatrix<BaseFloat> input_frames(word_ids_in.size(), input_dim);\n+\n+  for (int j = 0; j < word_ids_in.size(); j++) {\n+    vector<std::pair<MatrixIndexT, BaseFloat> > pairs;\n+    pairs.push_back(std::make_pair(word_ids_in[j], 1.0));\n+    SparseVector<BaseFloat> v(input_dim, pairs);\n+    input_frames.SetRow(j, v);\n+  }\n+\n+  NnetExample eg;\n+  eg.io.push_back(nnet3::NnetIo(\"input\", 0, input_frames));\n+\n+  Posterior posterior;\n+  for (int i = 0; i < word_ids_out.size(); i++) {\n+    vector<std::pair<int32, BaseFloat> > p;\n+    p.push_back(std::make_pair(word_ids_out[i], 1.0));\n+    posterior.push_back(p);\n+  }\n+\n+  eg.io.push_back(nnet3::NnetIo(\"output\", output_dim, 0, posterior));\n+  return eg;\n+}\n+\n+void SelectWithoutReplacement(const vector<BaseFloat> &u, int n, vector<int> *out) {","path":"src/rnnlm/rnnlm-utils.cc","position":53,"original_position":53,"commit_id":"d9677a309803fc8f624fd88dcc943592ae16970c","original_commit_id":"d9677a309803fc8f624fd88dcc943592ae16970c","user":{"login":"danpovey","id":3298747,"avatar_url":"https://avatars.githubusercontent.com/u/3298747?v=3","gravatar_id":"","url":"https://api.github.com/users/danpovey","html_url":"https://github.com/danpovey","followers_url":"https://api.github.com/users/danpovey/followers","following_url":"https://api.github.com/users/danpovey/following{/other_user}","gists_url":"https://api.github.com/users/danpovey/gists{/gist_id}","starred_url":"https://api.github.com/users/danpovey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danpovey/subscriptions","organizations_url":"https://api.github.com/users/danpovey/orgs","repos_url":"https://api.github.com/users/danpovey/repos","events_url":"https://api.github.com/users/danpovey/events{/privacy}","received_events_url":"https://api.github.com/users/danpovey/received_events","type":"User","site_admin":false},"body":"as I said before, this should have 'sample' in the name, not 'select' (sample implies randomness).","created_at":"2016-12-28T20:40:09Z","updated_at":"2016-12-28T20:40:09Z","html_url":"https://github.com/kaldi-asr/kaldi/pull/1279#discussion_r94075220","pull_request_url":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279","_links":{"self":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/comments/94075220"},"html":{"href":"https://github.com/kaldi-asr/kaldi/pull/1279#discussion_r94075220"},"pull_request":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279"}}},"pull_request":{"url":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279","id":98814489,"html_url":"https://github.com/kaldi-asr/kaldi/pull/1279","diff_url":"https://github.com/kaldi-asr/kaldi/pull/1279.diff","patch_url":"https://github.com/kaldi-asr/kaldi/pull/1279.patch","issue_url":"https://api.github.com/repos/kaldi-asr/kaldi/issues/1279","number":1279,"state":"open","locked":false,"title":"My rnnlm","user":{"login":"hainan-xv","id":5440014,"avatar_url":"https://avatars.githubusercontent.com/u/5440014?v=3","gravatar_id":"","url":"https://api.github.com/users/hainan-xv","html_url":"https://github.com/hainan-xv","followers_url":"https://api.github.com/users/hainan-xv/followers","following_url":"https://api.github.com/users/hainan-xv/following{/other_user}","gists_url":"https://api.github.com/users/hainan-xv/gists{/gist_id}","starred_url":"https://api.github.com/users/hainan-xv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainan-xv/subscriptions","organizations_url":"https://api.github.com/users/hainan-xv/orgs","repos_url":"https://api.github.com/users/hainan-xv/repos","events_url":"https://api.github.com/users/hainan-xv/events{/privacy}","received_events_url":"https://api.github.com/users/hainan-xv/received_events","type":"User","site_admin":false},"body":"Not a ready PR yet; just to make it easier to see the changes ","created_at":"2016-12-20T19:54:10Z","updated_at":"2016-12-28T20:40:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8efdd6cc5be932bceeb3813d94ab3675a3a181f6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279/commits","review_comments_url":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279/comments","review_comment_url":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kaldi-asr/kaldi/issues/1279/comments","statuses_url":"https://api.github.com/repos/kaldi-asr/kaldi/statuses/d9677a309803fc8f624fd88dcc943592ae16970c","head":{"label":"hainan-xv:my-rnnlm","ref":"my-rnnlm","sha":"d9677a309803fc8f624fd88dcc943592ae16970c","user":{"login":"hainan-xv","id":5440014,"avatar_url":"https://avatars.githubusercontent.com/u/5440014?v=3","gravatar_id":"","url":"https://api.github.com/users/hainan-xv","html_url":"https://github.com/hainan-xv","followers_url":"https://api.github.com/users/hainan-xv/followers","following_url":"https://api.github.com/users/hainan-xv/following{/other_user}","gists_url":"https://api.github.com/users/hainan-xv/gists{/gist_id}","starred_url":"https://api.github.com/users/hainan-xv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainan-xv/subscriptions","organizations_url":"https://api.github.com/users/hainan-xv/orgs","repos_url":"https://api.github.com/users/hainan-xv/repos","events_url":"https://api.github.com/users/hainan-xv/events{/privacy}","received_events_url":"https://api.github.com/users/hainan-xv/received_events","type":"User","site_admin":false},"repo":{"id":43703911,"name":"kaldi","full_name":"hainan-xv/kaldi","owner":{"login":"hainan-xv","id":5440014,"avatar_url":"https://avatars.githubusercontent.com/u/5440014?v=3","gravatar_id":"","url":"https://api.github.com/users/hainan-xv","html_url":"https://github.com/hainan-xv","followers_url":"https://api.github.com/users/hainan-xv/followers","following_url":"https://api.github.com/users/hainan-xv/following{/other_user}","gists_url":"https://api.github.com/users/hainan-xv/gists{/gist_id}","starred_url":"https://api.github.com/users/hainan-xv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainan-xv/subscriptions","organizations_url":"https://api.github.com/users/hainan-xv/orgs","repos_url":"https://api.github.com/users/hainan-xv/repos","events_url":"https://api.github.com/users/hainan-xv/events{/privacy}","received_events_url":"https://api.github.com/users/hainan-xv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hainan-xv/kaldi","description":"This is now the official location of the Kaldi project.","fork":true,"url":"https://api.github.com/repos/hainan-xv/kaldi","forks_url":"https://api.github.com/repos/hainan-xv/kaldi/forks","keys_url":"https://api.github.com/repos/hainan-xv/kaldi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hainan-xv/kaldi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hainan-xv/kaldi/teams","hooks_url":"https://api.github.com/repos/hainan-xv/kaldi/hooks","issue_events_url":"https://api.github.com/repos/hainan-xv/kaldi/issues/events{/number}","events_url":"https://api.github.com/repos/hainan-xv/kaldi/events","assignees_url":"https://api.github.com/repos/hainan-xv/kaldi/assignees{/user}","branches_url":"https://api.github.com/repos/hainan-xv/kaldi/branches{/branch}","tags_url":"https://api.github.com/repos/hainan-xv/kaldi/tags","blobs_url":"https://api.github.com/repos/hainan-xv/kaldi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hainan-xv/kaldi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hainan-xv/kaldi/git/refs{/sha}","trees_url":"https://api.github.com/repos/hainan-xv/kaldi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hainan-xv/kaldi/statuses/{sha}","languages_url":"https://api.github.com/repos/hainan-xv/kaldi/languages","stargazers_url":"https://api.github.com/repos/hainan-xv/kaldi/stargazers","contributors_url":"https://api.github.com/repos/hainan-xv/kaldi/contributors","subscribers_url":"https://api.github.com/repos/hainan-xv/kaldi/subscribers","subscription_url":"https://api.github.com/repos/hainan-xv/kaldi/subscription","commits_url":"https://api.github.com/repos/hainan-xv/kaldi/commits{/sha}","git_commits_url":"https://api.github.com/repos/hainan-xv/kaldi/git/commits{/sha}","comments_url":"https://api.github.com/repos/hainan-xv/kaldi/comments{/number}","issue_comment_url":"https://api.github.com/repos/hainan-xv/kaldi/issues/comments{/number}","contents_url":"https://api.github.com/repos/hainan-xv/kaldi/contents/{+path}","compare_url":"https://api.github.com/repos/hainan-xv/kaldi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hainan-xv/kaldi/merges","archive_url":"https://api.github.com/repos/hainan-xv/kaldi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hainan-xv/kaldi/downloads","issues_url":"https://api.github.com/repos/hainan-xv/kaldi/issues{/number}","pulls_url":"https://api.github.com/repos/hainan-xv/kaldi/pulls{/number}","milestones_url":"https://api.github.com/repos/hainan-xv/kaldi/milestones{/number}","notifications_url":"https://api.github.com/repos/hainan-xv/kaldi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hainan-xv/kaldi/labels{/name}","releases_url":"https://api.github.com/repos/hainan-xv/kaldi/releases{/id}","deployments_url":"https://api.github.com/repos/hainan-xv/kaldi/deployments","created_at":"2015-10-05T18:10:23Z","updated_at":"2016-08-19T20:48:25Z","pushed_at":"2016-12-28T20:17:52Z","git_url":"git://github.com/hainan-xv/kaldi.git","ssh_url":"git@github.com:hainan-xv/kaldi.git","clone_url":"https://github.com/hainan-xv/kaldi.git","svn_url":"https://github.com/hainan-xv/kaldi","homepage":"http://kaldi-asr.org","size":104932,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"kaldi-asr:master","ref":"master","sha":"ba58e8e55ed1777969e670980dbbc17c0eef530c","user":{"login":"kaldi-asr","id":11650082,"avatar_url":"https://avatars.githubusercontent.com/u/11650082?v=3","gravatar_id":"","url":"https://api.github.com/users/kaldi-asr","html_url":"https://github.com/kaldi-asr","followers_url":"https://api.github.com/users/kaldi-asr/followers","following_url":"https://api.github.com/users/kaldi-asr/following{/other_user}","gists_url":"https://api.github.com/users/kaldi-asr/gists{/gist_id}","starred_url":"https://api.github.com/users/kaldi-asr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaldi-asr/subscriptions","organizations_url":"https://api.github.com/users/kaldi-asr/orgs","repos_url":"https://api.github.com/users/kaldi-asr/repos","events_url":"https://api.github.com/users/kaldi-asr/events{/privacy}","received_events_url":"https://api.github.com/users/kaldi-asr/received_events","type":"Organization","site_admin":false},"repo":{"id":34275045,"name":"kaldi","full_name":"kaldi-asr/kaldi","owner":{"login":"kaldi-asr","id":11650082,"avatar_url":"https://avatars.githubusercontent.com/u/11650082?v=3","gravatar_id":"","url":"https://api.github.com/users/kaldi-asr","html_url":"https://github.com/kaldi-asr","followers_url":"https://api.github.com/users/kaldi-asr/followers","following_url":"https://api.github.com/users/kaldi-asr/following{/other_user}","gists_url":"https://api.github.com/users/kaldi-asr/gists{/gist_id}","starred_url":"https://api.github.com/users/kaldi-asr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaldi-asr/subscriptions","organizations_url":"https://api.github.com/users/kaldi-asr/orgs","repos_url":"https://api.github.com/users/kaldi-asr/repos","events_url":"https://api.github.com/users/kaldi-asr/events{/privacy}","received_events_url":"https://api.github.com/users/kaldi-asr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kaldi-asr/kaldi","description":"This is now the official location of the Kaldi project.","fork":false,"url":"https://api.github.com/repos/kaldi-asr/kaldi","forks_url":"https://api.github.com/repos/kaldi-asr/kaldi/forks","keys_url":"https://api.github.com/repos/kaldi-asr/kaldi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaldi-asr/kaldi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaldi-asr/kaldi/teams","hooks_url":"https://api.github.com/repos/kaldi-asr/kaldi/hooks","issue_events_url":"https://api.github.com/repos/kaldi-asr/kaldi/issues/events{/number}","events_url":"https://api.github.com/repos/kaldi-asr/kaldi/events","assignees_url":"https://api.github.com/repos/kaldi-asr/kaldi/assignees{/user}","branches_url":"https://api.github.com/repos/kaldi-asr/kaldi/branches{/branch}","tags_url":"https://api.github.com/repos/kaldi-asr/kaldi/tags","blobs_url":"https://api.github.com/repos/kaldi-asr/kaldi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaldi-asr/kaldi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaldi-asr/kaldi/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaldi-asr/kaldi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaldi-asr/kaldi/statuses/{sha}","languages_url":"https://api.github.com/repos/kaldi-asr/kaldi/languages","stargazers_url":"https://api.github.com/repos/kaldi-asr/kaldi/stargazers","contributors_url":"https://api.github.com/repos/kaldi-asr/kaldi/contributors","subscribers_url":"https://api.github.com/repos/kaldi-asr/kaldi/subscribers","subscription_url":"https://api.github.com/repos/kaldi-asr/kaldi/subscription","commits_url":"https://api.github.com/repos/kaldi-asr/kaldi/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaldi-asr/kaldi/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaldi-asr/kaldi/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaldi-asr/kaldi/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaldi-asr/kaldi/contents/{+path}","compare_url":"https://api.github.com/repos/kaldi-asr/kaldi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaldi-asr/kaldi/merges","archive_url":"https://api.github.com/repos/kaldi-asr/kaldi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaldi-asr/kaldi/downloads","issues_url":"https://api.github.com/repos/kaldi-asr/kaldi/issues{/number}","pulls_url":"https://api.github.com/repos/kaldi-asr/kaldi/pulls{/number}","milestones_url":"https://api.github.com/repos/kaldi-asr/kaldi/milestones{/number}","notifications_url":"https://api.github.com/repos/kaldi-asr/kaldi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaldi-asr/kaldi/labels{/name}","releases_url":"https://api.github.com/repos/kaldi-asr/kaldi/releases{/id}","deployments_url":"https://api.github.com/repos/kaldi-asr/kaldi/deployments","created_at":"2015-04-20T17:23:16Z","updated_at":"2016-12-28T14:55:03Z","pushed_at":"2016-12-28T20:17:54Z","git_url":"git://github.com/kaldi-asr/kaldi.git","ssh_url":"git@github.com:kaldi-asr/kaldi.git","clone_url":"https://github.com/kaldi-asr/kaldi.git","svn_url":"https://github.com/kaldi-asr/kaldi","homepage":"http://kaldi-asr.org","size":104392,"stargazers_count":1403,"watchers_count":1403,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":717,"mirror_url":null,"open_issues_count":110,"forks":717,"open_issues":110,"watchers":1403,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279"},"html":{"href":"https://github.com/kaldi-asr/kaldi/pull/1279"},"issue":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/issues/1279"},"comments":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/issues/1279/comments"},"review_comments":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279/comments"},"review_comment":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/pulls/1279/commits"},"statuses":{"href":"https://api.github.com/repos/kaldi-asr/kaldi/statuses/d9677a309803fc8f624fd88dcc943592ae16970c"}}}}
{"actor":{"display_login":"danpovey"}}