{"action":"created","comment":{"url":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/comments/198840616","pull_request_review_id":132842123,"id":198840616,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODg0MDYxNg==","diff_hunk":"@@ -198,4 +222,94 @@ namespace onmt\n     return min_index;\n   }\n \n+  void BPE::init_bpe_vocab(std::string vocab_path, int bpe_vocab_threshold)\n+  {\n+    std::ifstream in(vocab_path.c_str());\n+\n+    if (!in.is_open())\n+      throw std::invalid_argument(\"Unable to open BPE vocab file `\" + vocab_path + \"'\");\n+\n+    std::string line;\n+    while (std::getline(in, line))\n+    {\n+      size_t sep = line.find(' ');\n+      if (sep != std::string::npos)\n+      {\n+        if(std::stoi(line.substr(sep + 1)) >= bpe_vocab_threshold)\n+          _bpe_vocab.emplace(line.substr(0, sep));\n+      }\n+    }\n+  }\n+\n+  void BPE::check_vocab_and_split(std::vector<std::string> & orig, std::vector<std::string> & out) const","path":"src/BPE.cc","position":117,"original_position":117,"commit_id":"60fed9bdfc63a16a91ba01486185acf6a9be839b","original_commit_id":"60fed9bdfc63a16a91ba01486185acf6a9be839b","user":{"login":"monsieurzhang","id":29779073,"node_id":"MDQ6VXNlcjI5Nzc5MDcz","avatar_url":"https://avatars1.githubusercontent.com/u/29779073?v=4","gravatar_id":"","url":"https://api.github.com/users/monsieurzhang","html_url":"https://github.com/monsieurzhang","followers_url":"https://api.github.com/users/monsieurzhang/followers","following_url":"https://api.github.com/users/monsieurzhang/following{/other_user}","gists_url":"https://api.github.com/users/monsieurzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/monsieurzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monsieurzhang/subscriptions","organizations_url":"https://api.github.com/users/monsieurzhang/orgs","repos_url":"https://api.github.com/users/monsieurzhang/repos","events_url":"https://api.github.com/users/monsieurzhang/events{/privacy}","received_events_url":"https://api.github.com/users/monsieurzhang/received_events","type":"User","site_admin":false},"body":"fix","created_at":"2018-06-28T13:31:54Z","updated_at":"2018-06-28T13:31:54Z","html_url":"https://github.com/OpenNMT/Tokenizer/pull/22#discussion_r198840616","pull_request_url":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/comments/198840616"},"html":{"href":"https://github.com/OpenNMT/Tokenizer/pull/22#discussion_r198840616"},"pull_request":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22"}},"in_reply_to_id":198828214},"pull_request":{"url":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22","id":198008528,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MDA4NTI4","html_url":"https://github.com/OpenNMT/Tokenizer/pull/22","diff_url":"https://github.com/OpenNMT/Tokenizer/pull/22.diff","patch_url":"https://github.com/OpenNMT/Tokenizer/pull/22.patch","issue_url":"https://api.github.com/repos/OpenNMT/Tokenizer/issues/22","number":22,"state":"open","locked":false,"title":"Bpe vocab","user":{"login":"monsieurzhang","id":29779073,"node_id":"MDQ6VXNlcjI5Nzc5MDcz","avatar_url":"https://avatars1.githubusercontent.com/u/29779073?v=4","gravatar_id":"","url":"https://api.github.com/users/monsieurzhang","html_url":"https://github.com/monsieurzhang","followers_url":"https://api.github.com/users/monsieurzhang/followers","following_url":"https://api.github.com/users/monsieurzhang/following{/other_user}","gists_url":"https://api.github.com/users/monsieurzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/monsieurzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monsieurzhang/subscriptions","organizations_url":"https://api.github.com/users/monsieurzhang/orgs","repos_url":"https://api.github.com/users/monsieurzhang/repos","events_url":"https://api.github.com/users/monsieurzhang/events{/privacy}","received_events_url":"https://api.github.com/users/monsieurzhang/received_events","type":"User","site_admin":false},"body":"support vocab","created_at":"2018-06-28T12:08:30Z","updated_at":"2018-06-28T13:31:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e51dd9ca024a70803defe4973cc618c7831d050","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22/commits","review_comments_url":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22/comments","review_comment_url":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenNMT/Tokenizer/issues/22/comments","statuses_url":"https://api.github.com/repos/OpenNMT/Tokenizer/statuses/60fed9bdfc63a16a91ba01486185acf6a9be839b","head":{"label":"monsieurzhang:bpe_vocab","ref":"bpe_vocab","sha":"60fed9bdfc63a16a91ba01486185acf6a9be839b","user":{"login":"monsieurzhang","id":29779073,"node_id":"MDQ6VXNlcjI5Nzc5MDcz","avatar_url":"https://avatars1.githubusercontent.com/u/29779073?v=4","gravatar_id":"","url":"https://api.github.com/users/monsieurzhang","html_url":"https://github.com/monsieurzhang","followers_url":"https://api.github.com/users/monsieurzhang/followers","following_url":"https://api.github.com/users/monsieurzhang/following{/other_user}","gists_url":"https://api.github.com/users/monsieurzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/monsieurzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monsieurzhang/subscriptions","organizations_url":"https://api.github.com/users/monsieurzhang/orgs","repos_url":"https://api.github.com/users/monsieurzhang/repos","events_url":"https://api.github.com/users/monsieurzhang/events{/privacy}","received_events_url":"https://api.github.com/users/monsieurzhang/received_events","type":"User","site_admin":false},"repo":{"id":125544085,"node_id":"MDEwOlJlcG9zaXRvcnkxMjU1NDQwODU=","name":"Tokenizer","full_name":"monsieurzhang/Tokenizer","owner":{"login":"monsieurzhang","id":29779073,"node_id":"MDQ6VXNlcjI5Nzc5MDcz","avatar_url":"https://avatars1.githubusercontent.com/u/29779073?v=4","gravatar_id":"","url":"https://api.github.com/users/monsieurzhang","html_url":"https://github.com/monsieurzhang","followers_url":"https://api.github.com/users/monsieurzhang/followers","following_url":"https://api.github.com/users/monsieurzhang/following{/other_user}","gists_url":"https://api.github.com/users/monsieurzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/monsieurzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monsieurzhang/subscriptions","organizations_url":"https://api.github.com/users/monsieurzhang/orgs","repos_url":"https://api.github.com/users/monsieurzhang/repos","events_url":"https://api.github.com/users/monsieurzhang/events{/privacy}","received_events_url":"https://api.github.com/users/monsieurzhang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/monsieurzhang/Tokenizer","description":"OpenNMT C++ tokenizer","fork":true,"url":"https://api.github.com/repos/monsieurzhang/Tokenizer","forks_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/forks","keys_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/teams","hooks_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/hooks","issue_events_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/issues/events{/number}","events_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/events","assignees_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/assignees{/user}","branches_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/branches{/branch}","tags_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/tags","blobs_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/git/refs{/sha}","trees_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/statuses/{sha}","languages_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/languages","stargazers_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/stargazers","contributors_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/contributors","subscribers_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/subscribers","subscription_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/subscription","commits_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/commits{/sha}","git_commits_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/git/commits{/sha}","comments_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/comments{/number}","issue_comment_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/issues/comments{/number}","contents_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/contents/{+path}","compare_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/merges","archive_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/downloads","issues_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/issues{/number}","pulls_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/pulls{/number}","milestones_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/milestones{/number}","notifications_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/labels{/name}","releases_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/releases{/id}","deployments_url":"https://api.github.com/repos/monsieurzhang/Tokenizer/deployments","created_at":"2018-03-16T16:44:38Z","updated_at":"2018-03-16T16:44:39Z","pushed_at":"2018-06-28T12:05:57Z","git_url":"git://github.com/monsieurzhang/Tokenizer.git","ssh_url":"git@github.com:monsieurzhang/Tokenizer.git","clone_url":"https://github.com/monsieurzhang/Tokenizer.git","svn_url":"https://github.com/monsieurzhang/Tokenizer","homepage":"","size":741,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenNMT:master","ref":"master","sha":"82f695713fa2f37ffee4645d8b09071074e53ad4","user":{"login":"OpenNMT","id":23035727,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDM1NzI3","avatar_url":"https://avatars2.githubusercontent.com/u/23035727?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenNMT","html_url":"https://github.com/OpenNMT","followers_url":"https://api.github.com/users/OpenNMT/followers","following_url":"https://api.github.com/users/OpenNMT/following{/other_user}","gists_url":"https://api.github.com/users/OpenNMT/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenNMT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenNMT/subscriptions","organizations_url":"https://api.github.com/users/OpenNMT/orgs","repos_url":"https://api.github.com/users/OpenNMT/repos","events_url":"https://api.github.com/users/OpenNMT/events{/privacy}","received_events_url":"https://api.github.com/users/OpenNMT/received_events","type":"Organization","site_admin":false},"repo":{"id":81958932,"node_id":"MDEwOlJlcG9zaXRvcnk4MTk1ODkzMg==","name":"Tokenizer","full_name":"OpenNMT/Tokenizer","owner":{"login":"OpenNMT","id":23035727,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDM1NzI3","avatar_url":"https://avatars2.githubusercontent.com/u/23035727?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenNMT","html_url":"https://github.com/OpenNMT","followers_url":"https://api.github.com/users/OpenNMT/followers","following_url":"https://api.github.com/users/OpenNMT/following{/other_user}","gists_url":"https://api.github.com/users/OpenNMT/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenNMT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenNMT/subscriptions","organizations_url":"https://api.github.com/users/OpenNMT/orgs","repos_url":"https://api.github.com/users/OpenNMT/repos","events_url":"https://api.github.com/users/OpenNMT/events{/privacy}","received_events_url":"https://api.github.com/users/OpenNMT/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenNMT/Tokenizer","description":"OpenNMT C++ tokenizer","fork":false,"url":"https://api.github.com/repos/OpenNMT/Tokenizer","forks_url":"https://api.github.com/repos/OpenNMT/Tokenizer/forks","keys_url":"https://api.github.com/repos/OpenNMT/Tokenizer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenNMT/Tokenizer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenNMT/Tokenizer/teams","hooks_url":"https://api.github.com/repos/OpenNMT/Tokenizer/hooks","issue_events_url":"https://api.github.com/repos/OpenNMT/Tokenizer/issues/events{/number}","events_url":"https://api.github.com/repos/OpenNMT/Tokenizer/events","assignees_url":"https://api.github.com/repos/OpenNMT/Tokenizer/assignees{/user}","branches_url":"https://api.github.com/repos/OpenNMT/Tokenizer/branches{/branch}","tags_url":"https://api.github.com/repos/OpenNMT/Tokenizer/tags","blobs_url":"https://api.github.com/repos/OpenNMT/Tokenizer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenNMT/Tokenizer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenNMT/Tokenizer/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenNMT/Tokenizer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenNMT/Tokenizer/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenNMT/Tokenizer/languages","stargazers_url":"https://api.github.com/repos/OpenNMT/Tokenizer/stargazers","contributors_url":"https://api.github.com/repos/OpenNMT/Tokenizer/contributors","subscribers_url":"https://api.github.com/repos/OpenNMT/Tokenizer/subscribers","subscription_url":"https://api.github.com/repos/OpenNMT/Tokenizer/subscription","commits_url":"https://api.github.com/repos/OpenNMT/Tokenizer/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenNMT/Tokenizer/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenNMT/Tokenizer/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenNMT/Tokenizer/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenNMT/Tokenizer/contents/{+path}","compare_url":"https://api.github.com/repos/OpenNMT/Tokenizer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenNMT/Tokenizer/merges","archive_url":"https://api.github.com/repos/OpenNMT/Tokenizer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenNMT/Tokenizer/downloads","issues_url":"https://api.github.com/repos/OpenNMT/Tokenizer/issues{/number}","pulls_url":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenNMT/Tokenizer/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenNMT/Tokenizer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenNMT/Tokenizer/labels{/name}","releases_url":"https://api.github.com/repos/OpenNMT/Tokenizer/releases{/id}","deployments_url":"https://api.github.com/repos/OpenNMT/Tokenizer/deployments","created_at":"2017-02-14T15:23:39Z","updated_at":"2018-06-22T14:38:36Z","pushed_at":"2018-06-28T12:08:31Z","git_url":"git://github.com/OpenNMT/Tokenizer.git","ssh_url":"git@github.com:OpenNMT/Tokenizer.git","clone_url":"https://github.com/OpenNMT/Tokenizer.git","svn_url":"https://github.com/OpenNMT/Tokenizer","homepage":"","size":730,"stargazers_count":10,"watchers_count":10,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":10,"open_issues":3,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22"},"html":{"href":"https://github.com/OpenNMT/Tokenizer/pull/22"},"issue":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/issues/22"},"comments":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/OpenNMT/Tokenizer/statuses/60fed9bdfc63a16a91ba01486185acf6a9be839b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"monsieurzhang"}}