{"action":"created","issue":{"url":"https://api.github.com/repos/piskvorky/gensim/issues/541","labels_url":"https://api.github.com/repos/piskvorky/gensim/issues/541/labels{/name}","comments_url":"https://api.github.com/repos/piskvorky/gensim/issues/541/comments","events_url":"https://api.github.com/repos/piskvorky/gensim/issues/541/events","html_url":"https://github.com/piskvorky/gensim/issues/541","id":118526714,"number":541,"title":"RuntimeError: you must first build vocabulary before training the model","user":{"login":"Rahulvks","id":14966169,"avatar_url":"https://avatars.githubusercontent.com/u/14966169?v=3","gravatar_id":"","url":"https://api.github.com/users/Rahulvks","html_url":"https://github.com/Rahulvks","followers_url":"https://api.github.com/users/Rahulvks/followers","following_url":"https://api.github.com/users/Rahulvks/following{/other_user}","gists_url":"https://api.github.com/users/Rahulvks/gists{/gist_id}","starred_url":"https://api.github.com/users/Rahulvks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rahulvks/subscriptions","organizations_url":"https://api.github.com/users/Rahulvks/orgs","repos_url":"https://api.github.com/users/Rahulvks/repos","events_url":"https://api.github.com/users/Rahulvks/events{/privacy}","received_events_url":"https://api.github.com/users/Rahulvks/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-24T03:53:42Z","updated_at":"2015-11-24T12:51:22Z","closed_at":"2015-11-24T05:07:16Z","body":"Facing error when importing Word2vec \r\n\r\nTraceback (most recent call last):\r\n  File \"<pyshell#0>\", line 1, in <module>\r\n    import word2vec\r\n  File \"word2vec.py\", line 14, in <module>\r\n    model = word2vec.Word2Vec(sentences, size=100, window=4, min_count=1, workers=4)\r\n  File \"/usr/local/lib/python2.7/dist-packages/gensim-0.12.3-py2.7-linux-x86_64.egg/gensim/models/word2vec.py\", line 432, in __init__\r\n    self.train(sentences)\r\n  File \"/usr/local/lib/python2.7/dist-packages/gensim-0.12.3-py2.7-linux-x86_64.egg/gensim/models/word2vec.py\", line 690, in train\r\n    raise RuntimeError(\"you must first build vocabulary before training the model\")\r\nRuntimeError: you must first build vocabulary before training the model\r\n\r\nHow to train first and build vocabulary ?\r\nKindly anyone help"},"comment":{"url":"https://api.github.com/repos/piskvorky/gensim/issues/comments/159258230","html_url":"https://github.com/piskvorky/gensim/issues/541#issuecomment-159258230","issue_url":"https://api.github.com/repos/piskvorky/gensim/issues/541","id":159258230,"user":{"login":"gojomo","id":1641,"avatar_url":"https://avatars.githubusercontent.com/u/1641?v=3","gravatar_id":"","url":"https://api.github.com/users/gojomo","html_url":"https://github.com/gojomo","followers_url":"https://api.github.com/users/gojomo/followers","following_url":"https://api.github.com/users/gojomo/following{/other_user}","gists_url":"https://api.github.com/users/gojomo/gists{/gist_id}","starred_url":"https://api.github.com/users/gojomo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gojomo/subscriptions","organizations_url":"https://api.github.com/users/gojomo/orgs","repos_url":"https://api.github.com/users/gojomo/repos","events_url":"https://api.github.com/users/gojomo/events{/privacy}","received_events_url":"https://api.github.com/users/gojomo/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T12:51:22Z","updated_at":"2015-11-24T12:51:22Z","body":"If you supply `sentences` at class-initialization, then it automatically does both the `build_vocab()` step and the `train()` step. There's no reason to call `build_vocab()` again. "}}