資源簡介
wrod2vec谷歌詞向量實驗工具,壓縮文檔中有詞向量實驗的具體使用說明txt文檔。
代碼片段和文件信息
//??Copyright?2013?Google?Inc.?All?Rights?Reserved.
//
//??Licensed?under?the?Apache?License?Version?2.0?(the?“License“);
//??you?may?not?use?this?file?except?in?compliance?with?the?License.
//??You?may?obtain?a?copy?of?the?License?at
//
//??????http://www.apache.org/licenses/LICENSE-2.0
//
//??Unless?required?by?applicable?law?or?agreed?to?in?writing?software
//??distributed?under?the?License?is?distributed?on?an?“AS?IS“?BASIS
//??WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND?either?express?or?implied.
//??See?the?License?for?the?specific?language?governing?permissions?and
//??limitations?under?the?License.
#include?
#include?
#include?
#include?
#include?
#include?
const?long?long?max_size?=?2000;?????????//?max?length?of?strings
const?long?long?N?=?1;???????????????????//?number?of?closest?words
const?long?long?max_w?=?50;??????????????//?max?length?of?vocabulary?entries
int?main(int?argc?char?**argv)
{
??FILE?*f;
??char?st1[max_size]?st2[max_size]?st3[max_size]?st4[max_size]?bestw[N][max_size]?file_name[max_size]?ch;
??float?dist?len?bestd[N]?vec[max_size];
??long?long?words?size?a?b?c?d?b1?b2?b3?threshold?=?0;
??float?*M;
??char?*vocab;
??int?TCN?CCN?=?0?TACN?=?0?CACN?=?0?SECN?=?0?SYCN?=?0?SEAC?=?0?SYAC?=?0?QID?=?0?TQ?=?0?TQS?=?0;
??if?(argc?2)?{
????printf(“Usage:?./compute-accuracy??\nwhere?FILE?contains?word?projections?and?threshold?is?used?to?reduce?vocabulary?of?the?model?for?fast?approximate?evaluation?(0?=?off?otherwise?typical?value?is?30000)\n“);
????return?0;
??}
??strcpy(file_name?argv[1]);
??if?(argc?>?2)?threshold?=?atoi(argv[2]);
??f?=?fopen(file_name?“rb“);
??if?(f?==?NULL)?{
????printf(“Input?file?not?found\n“);
????return?-1;
??}
??fscanf(f?“%lld“?&words);
??if?(threshold)?if?(words?>?threshold)?words?=?threshold;
??fscanf(f?“%lld“?&size);
??vocab?=?(char?*)malloc(words?*?max_w?*?sizeof(char));
??M?=?(float?*)malloc(words?*?size?*?sizeof(float));
??if?(M?==?NULL)?{
????printf(“Cannot?allocate?memory:?%lld?MB\n“?words?*?size?*?sizeof(float)?/?1048576);
????return?-1;
??}
??for?(b?=?0;?b?????a?=?0;
????while?(1)?{
??????vocab[b?*?max_w?+?a]?=?fgetc(f);
??????if?(feof(f)?||?(vocab[b?*?max_w?+?a]?==?‘?‘))?break;
??????if?((a?????}
????vocab[b?*?max_w?+?a]?=?0;
????for?(a?=?0;?a?????for?(a?=?0;?a?????len?=?0;
????for?(a?=?0;?a?????len?=?sqrt(len);
????for?(a?=?0;?a???}
??fclose(f);
??TCN?=?0;
??while?(1)?{
????for?(a?=?0;?a?????for?(a?=?0;?a?????scanf(“%s“?st1);
????for?(a?=?0;?a?????if?((!strcmp(st1?“:“))?||?(!strcmp(st1?“EXIT“))?||?f
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-11-07?10:32??word2vec\
?????文件???????11358??2015-12-14?15:32??word2vec\LICENSE.txt
?????文件??????137271??2015-12-14?15:38??word2vec\QQ圖片20151214153912.png
?????文件????????1209??2017-10-24?20:31??word2vec\README.txt
?????文件???????13568??2017-10-25?20:07??word2vec\compute-accuracy
?????文件????????5241??2015-12-14?15:32??word2vec\compute-accuracy.c
?????文件?????????631??2015-12-14?15:32??word2vec\demo-analogy.sh
?????文件?????????358??2015-12-14?15:32??word2vec\demo-classes.sh
?????文件?????????885??2015-12-14?15:33??word2vec\demo-phrase-accuracy.sh
?????文件?????????853??2015-12-14?15:33??word2vec\demo-phrases.sh
?????文件????????5126??2015-12-14?15:33??word2vec\demo-train-big-model-v1.sh
?????文件?????????414??2015-12-14?15:33??word2vec\demo-word-accuracy.sh
?????文件?????????272??2017-10-25?20:06??word2vec\demo-word.sh
?????文件???????17535??2017-10-25?20:07??word2vec\distance
?????文件????????4557??2015-12-14?15:33??word2vec\distance.c
?????文件?????????685??2017-10-24?20:42??word2vec\makefile
?????文件?????????685??2017-10-24?20:42??word2vec\makefile.txt
?????文件??????168209??2015-12-14?15:33??word2vec\questions-phrases.txt
?????文件??????603955??2015-12-14?15:34??word2vec\questions-words.txt
?????文件???100000000??2006-06-09?20:40??word2vec\text8
?????文件????57704809??2017-10-25?20:14??word2vec\vectors.bin
?????文件???????21583??2017-10-25?20:07??word2vec\word-analogy
?????文件????????4664??2015-12-14?15:34??word2vec\word-analogy.c
?????文件???????23029??2017-10-25?20:07??word2vec\word2phrase
?????文件????????9386??2015-12-14?15:34??word2vec\word2phrase.c
?????文件???????49293??2017-10-25?20:07??word2vec\word2vec
?????文件???????26184??2015-12-14?15:34??word2vec\word2vec.c
?????文件????????2206??2017-10-25?16:30??word2vec\word2vec.txt
評論
共有 條評論