{
  "id": 140385,
  "title": "Code to extract embedding from zipfile",
  "url": "/competitions/quora-insincere-questions-classification/discussion/140385",
  "author_name": "",
  "post_date": "2020-04-01T15:26:46.958269700Z",
  "votes": 1,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Use the following code in order to extract single embedding from the zipfile without extracting entire zip file.</p>\n\n<p>```\nimport zipfile\nimport gensim</p>\n\n<p>archive = zipfile.ZipFile('../input/quora-insincere-questions-classification/embeddings.zip', 'r')</p>\n\n<h1>print(archive.namelist()) # print all zip content</h1>\n\n<p>embeddings = gensim.models.KeyedVectors.load_word2vec_format(archive.open('GoogleNews-vectors-negative300/GoogleNews-vectors-negative300.bin'), binary=True,limit=100000)\nprint(embeddings.most_similar(\"dog\"))\n```</p>",
  "messages": [
    {
      "id": "794124",
      "postDate": "04/01/2020 15:26:46",
      "content": "<p>Use the following code in order to extract single embedding from the zipfile without extracting entire zip file.</p>\n\n<p>```\nimport zipfile\nimport gensim</p>\n\n<p>archive = zipfile.ZipFile('../input/quora-insincere-questions-classification/embeddings.zip', 'r')</p>\n\n<h1>print(archive.namelist()) # print all zip content</h1>\n\n<p>embeddings = gensim.models.KeyedVectors.load_word2vec_format(archive.open('GoogleNews-vectors-negative300/GoogleNews-vectors-negative300.bin'), binary=True,limit=100000)\nprint(embeddings.most_similar(\"dog\"))\n```</p>",
      "rawMarkdown": "Use the following code in order to extract single embedding from the zipfile without extracting entire zip file.\n\n```\nimport zipfile\nimport gensim\n\narchive = zipfile.ZipFile('../input/quora-insincere-questions-classification/embeddings.zip', 'r')\n#print(archive.namelist()) # print all zip content\n\nembeddings = gensim.models.KeyedVectors.load_word2vec_format(archive.open('GoogleNews-vectors-negative300/GoogleNews-vectors-negative300.bin'), binary=True,limit=100000)\nprint(embeddings.most_similar(\"dog\"))\n```",
      "votes": null
    },
    {
      "id": "975036",
      "postDate": "08/18/2020 05:56:20",
      "content": "<p>Great, i was searching this. Thanks!! <br>\nBut for my case, the path it accepts '../input/embeddings.zip'  not     '../input/quora-insincere-questions-classification/embeddings.zip'</p>",
      "rawMarkdown": "Great, i was searching this. Thanks!! \nBut for my case, the path it accepts '../input/embeddings.zip'  not     '../input/quora-insincere-questions-classification/embeddings.zip'",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 975036,
      "author_name": "surendrakumar27",
      "author_url": "",
      "post_date": "08/18/2020 05:56:20",
      "content": "<p>Great, i was searching this. Thanks!! <br>\nBut for my case, the path it accepts '../input/embeddings.zip'  not     '../input/quora-insincere-questions-classification/embeddings.zip'</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "794124": "Use the following code in order to extract single embedding from the zipfile without extracting entire zip file.\n\n```\nimport zipfile\nimport gensim\n\narchive = zipfile.ZipFile('../input/quora-insincere-questions-classification/embeddings.zip', 'r')\n#print(archive.namelist()) # print all zip content\n\nembeddings = gensim.models.KeyedVectors.load_word2vec_format(archive.open('GoogleNews-vectors-negative300/GoogleNews-vectors-negative300.bin'), binary=True,limit=100000)\nprint(embeddings.most_similar(\"dog\"))\n```",
    "975036": "Great, i was searching this. Thanks!! \nBut for my case, the path it accepts '../input/embeddings.zip'  not     '../input/quora-insincere-questions-classification/embeddings.zip'"
  },
  "source": "meta"
}