thunlp / SE-WRL

Improved Word Representation Learning with Sememes
MIT License
195 stars 56 forks source link

数据预处理文件 & 其他语言 & 效率问题 #15

Closed guoyinwang closed 5 years ago

guoyinwang commented 6 years ago

请问可不可以发一下数据预处理的文件, 例如生成meaning, sememe, vocabulary这三个file的code。 我想在其他语料上跑一下这个模型,然后发现这份code对input格式要求很严格,我重做了input file后就会有很多问题。 一些是input格式,一些是code本身的parameter要改动。 所以想要一下数据预处理文件来去掉input的问题。

在其他中文语料上不能直接使用因为vocab不一样,如果像之前的issue只简单的作对齐的话,应该会丢失信息,所以想要重做三个input file。

另外想问有没有在英语上做类似的实验?

还有就是在加了sememe后是不是会training 速度降低很多?

heyLinsir commented 6 years ago

没有在英语上做类似的实验,因为其他语言没有类似HowNet的数据库。在加了sememe之后training速度会降低很多,因为相比于skipgram来说,复杂度大了很多。

生成word-sense-sememe对应关系的脚本在data process目录下,sememe文件只需要在一行中列出来所有的sememe即可,vocabulary只需要和word-sense-sememe文件的词序一致即可,请问在这种情况下还会出现问题吗?我没有保存这些数据处理文件,如果需要的话我再写一份。

guoyinwang commented 6 years ago

那个提取Hornet的 file我用python 3 跑了一下, 会报错。

处理数据的文件还是帮我写一份吧,因为发现差个换行符什么的就会让程序报错,所以有个模版我好比较一下我哪里处理的有问题。

MingleiLI commented 6 years ago

碰到同样的问题,换个vocab或training corpus就会报错,比如segmentation fault。另外,如果把训练模型的参数由-read-vocab改为-save-vocab也会报错。而在原始的Wordvec代码上跑就没有问题。

MingleiLI commented 6 years ago

另外,对数据文件的编码格式有没有什么要求?

MingleiLI commented 6 years ago

通过看代码发现,程序要默认vocab中的词和Word_Sense_Sememe_File中的词一样。否则,在初始化syn0的时候有的词可能没有初始化,导致后边读出的数值是随机数。

MingleiLI commented 6 years ago

SAT.c中 if (sentence_length == 0) { while (1) { word = ReadWordIndex(fi); if (feof(fi)) { // Read all the words until the end of file???? --lml break; } if (word == -1) { // word not in vocab. continue; } word_count++; if (sample > 0) { real ran = (sqrt(vocab[word].cn / (sample train_words)) + 1) (sample train_words) / vocab[word].cn; next_random = next_random (unsigned long long)25214903917 + 11; if (ran < (next_random & 0xFFFF) / (real)65536) continue; } sen[sentence_length] = word; sentence_length++; if (sentence_length >= MAX_SENTENCE_LENGTH) break; } sentence_position = 0; } 这里是读取文件直到达到MAX_SENTENCE_LENGTH吗?这样读进来的不一定都是在一个句子中吧。Wordvec.c中有if (word == 0) break;这句,请问sat.c中没有这句的考虑是什么呢?

heyLinsir commented 6 years ago

我们最近会放一个新版的出来,会比现在的版本在可读性和应用性上好很多,正在做验证实验。做完了会在我们组的GitHub上公布出来,并且在这个版本的README中附上链接。

MingleiLI commented 6 years ago

另外,你们用的gcc的版本是哪个,很多错误有没有可能是编译器版本不一样导致的?