for boundary check
This commit is contained in:
Родитель
de4399acf9
Коммит
20d0865b46
|
@ -331,6 +331,12 @@ namespace multiverso
|
||||||
//Read the vocabulary file; create the dictionary
|
//Read the vocabulary file; create the dictionary
|
||||||
//and huffman_encoder according opt
|
//and huffman_encoder according opt
|
||||||
|
|
||||||
|
if ((option_->hs == 1) && (option_->negative_num != 0))
|
||||||
|
{
|
||||||
|
multiverso::Log::Fatal("The Hierarchical Softmax and Negative Sampling is indefinite!\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
multiverso::Log::Info("Loading vocabulary ...\n");
|
multiverso::Log::Info("Loading vocabulary ...\n");
|
||||||
option_->total_words = LoadVocab(option_, dictionary_,
|
option_->total_words = LoadVocab(option_, dictionary_,
|
||||||
huffman_encoder_);
|
huffman_encoder_);
|
||||||
|
@ -411,6 +417,11 @@ namespace multiverso
|
||||||
multiverso::Log::Info("Begin to load vocabulary file [%s] ...\n",
|
multiverso::Log::Info("Begin to load vocabulary file [%s] ...\n",
|
||||||
opt->read_vocab_file);
|
opt->read_vocab_file);
|
||||||
fid = fopen(opt->read_vocab_file, "r");
|
fid = fopen(opt->read_vocab_file, "r");
|
||||||
|
if (fid == nullptr)
|
||||||
|
{
|
||||||
|
multiverso::Log::Fatal("Open vocab_file failed!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
int word_freq;
|
int word_freq;
|
||||||
while (fscanf(fid, "%s %d", word, &word_freq) != EOF)
|
while (fscanf(fid, "%s %d", word, &word_freq) != EOF)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,11 @@ namespace multiverso
|
||||||
if (option_->stopwords)
|
if (option_->stopwords)
|
||||||
{
|
{
|
||||||
FILE* fid = fopen(option_->sw_file, "r");
|
FILE* fid = fopen(option_->sw_file, "r");
|
||||||
|
if (fid == nullptr)
|
||||||
|
{
|
||||||
|
multiverso::Log::Fatal("Open sw_file failed!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
while (ReadWord(word_, fid))
|
while (ReadWord(word_, fid))
|
||||||
{
|
{
|
||||||
stopwords_table_.insert(word_);
|
stopwords_table_.insert(word_);
|
||||||
|
@ -24,6 +29,11 @@ namespace multiverso
|
||||||
}
|
}
|
||||||
|
|
||||||
file_ = fopen(input_file, "r");
|
file_ = fopen(input_file, "r");
|
||||||
|
if (file_ == nullptr)
|
||||||
|
{
|
||||||
|
multiverso::Log::Fatal("Open train_file failed!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reader::~Reader()
|
Reader::~Reader()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче