简体   繁体   English

将 word2vec 模型加载到 Mysql 数据库中

[英]loading a word2vec model into a Mysql database

I have a word2vec model stored in text file as我有一个 word2vec 模型存储在文本文件中

also -0.036738 -0.062687 -0.104392 -0.178325 0.010501 0.049380....
one -0.089568 -0.191083 0.038558 0.156755 -0.037399 -0.013798....

The size of the text file is more than 8GB.文本文件的大小超过 8GB。 I want to read this file into mysql database using the first word as key (in a column) and the rest of the line as another column.我想将此文件读入 mysql 数据库,使用第一个单词作为键(在一列中),并将该行的其余部分作为另一列。 Is it possible to do so without reading each line and splitting it?是否可以在不阅读每一行并将其拆分的情况下这样做?

I went through some related questions but it didn't match what I want.我经历了一些相关的问题,但它与我想要的不符。

How to read a file and add its content to database? 如何读取文件并将其内容添加到数据库?

read text file content and insert it into a mysql database 读取文本文件内容并将其插入到mysql数据库中

you can do it by:你可以这样做:

  1. making a simple for loop that iterates over the records on the model制作一个简单的 for 循环来迭代模型上的记录
  2. aggregating about 100 records on an array在一个数组上聚合大约 100 条记录
  3. using mysql bulk insert feature to insert 100s of records at once使用mysql批量插入功能一次插入100条记录

use a fast language like go if you can.如果可以的话,使用像 go 这样的快速语言。

This thing you are trying to do, it's very possible, let me know if you need code for this.您正在尝试做的这件事很有可能,如果您需要代码,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM