mirror of
https://github.com/fanlumaster/googlepinyinime-rev.git
synced 2025-07-18 08:57:54 +08:00
[log]: Fix incorrect format specifier in printf
This commit is contained in:
@ -278,7 +278,7 @@ void DictBuilder::get_top_lemmas() {
|
|||||||
if (kPrintDebug0) {
|
if (kPrintDebug0) {
|
||||||
printf("\n------Top Lemmas------------------\n");
|
printf("\n------Top Lemmas------------------\n");
|
||||||
for (size_t pos = 0; pos < top_lmas_num_; pos++) {
|
for (size_t pos = 0; pos < top_lmas_num_; pos++) {
|
||||||
printf("--%d, idx:%06d, score:%.5f\n", pos, top_lmas_[pos].idx_by_hz, top_lmas_[pos].freq);
|
printf("--%zu, idx:%06zu, score:%.5f\n", pos, top_lmas_[pos].idx_by_hz, top_lmas_[pos].freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -438,7 +438,7 @@ size_t DictBuilder::read_raw_dict(const char *fn_raw, const char *fn_validhzs, s
|
|||||||
delete[] valid_hzs;
|
delete[] valid_hzs;
|
||||||
utf16_reader.close();
|
utf16_reader.close();
|
||||||
|
|
||||||
printf("read succesfully, lemma num: %d\n", lemma_num);
|
printf("read succesfully, lemma num: %zu\n", lemma_num);
|
||||||
|
|
||||||
return lemma_num;
|
return lemma_num;
|
||||||
}
|
}
|
||||||
@ -548,9 +548,9 @@ bool DictBuilder::build_dict(const char *fn_raw, const char *fn_validhzs, DictTr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (kPrintDebug0) {
|
if (kPrintDebug0) {
|
||||||
printf("homo_idx_num_eq1_: %d\n", homo_idx_num_eq1_);
|
printf("homo_idx_num_eq1_: %zu\n", homo_idx_num_eq1_);
|
||||||
printf("homo_idx_num_gt1_: %d\n", homo_idx_num_gt1_);
|
printf("homo_idx_num_gt1_: %zu\n", homo_idx_num_gt1_);
|
||||||
printf("top_lmas_num_: %d\n", top_lmas_num_);
|
printf("top_lmas_num_: %zu\n", top_lmas_num_);
|
||||||
}
|
}
|
||||||
|
|
||||||
free_resource();
|
free_resource();
|
||||||
@ -910,40 +910,40 @@ void DictBuilder::stat_print() {
|
|||||||
printf("\n------------STAT INFO-------------\n");
|
printf("\n------------STAT INFO-------------\n");
|
||||||
printf("[root is layer -1]\n");
|
printf("[root is layer -1]\n");
|
||||||
printf(".. max_sonbuf_len per layer(from layer 0):\n ");
|
printf(".. max_sonbuf_len per layer(from layer 0):\n ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", max_sonbuf_len_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", max_sonbuf_len_[i]);
|
||||||
printf("-, \n");
|
printf("-, \n");
|
||||||
|
|
||||||
printf(".. max_homobuf_len per layer:\n -, ");
|
printf(".. max_homobuf_len per layer:\n -, ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", max_homobuf_len_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", max_homobuf_len_[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(".. total_son_num per layer:\n ");
|
printf(".. total_son_num per layer:\n ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", total_son_num_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", total_son_num_[i]);
|
||||||
printf("-, \n");
|
printf("-, \n");
|
||||||
|
|
||||||
printf(".. total_node_hasson per layer:\n 1, ");
|
printf(".. total_node_hasson per layer:\n 1, ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", total_node_hasson_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", total_node_hasson_[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(".. total_sonbuf_num per layer:\n ");
|
printf(".. total_sonbuf_num per layer:\n ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", total_sonbuf_num_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", total_sonbuf_num_[i]);
|
||||||
printf("-, \n");
|
printf("-, \n");
|
||||||
|
|
||||||
printf(".. total_sonbuf_allnoson per layer:\n ");
|
printf(".. total_sonbuf_allnoson per layer:\n ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", total_sonbuf_allnoson_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", total_sonbuf_allnoson_[i]);
|
||||||
printf("-, \n");
|
printf("-, \n");
|
||||||
|
|
||||||
printf(".. total_node_in_sonbuf_allnoson per layer:\n ");
|
printf(".. total_node_in_sonbuf_allnoson per layer:\n ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", total_node_in_sonbuf_allnoson_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", total_node_in_sonbuf_allnoson_[i]);
|
||||||
printf("-, \n");
|
printf("-, \n");
|
||||||
|
|
||||||
printf(".. total_homo_num per layer:\n 0, ");
|
printf(".. total_homo_num per layer:\n 0, ");
|
||||||
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%d, ", total_homo_num_[i]);
|
for (size_t i = 0; i < kMaxLemmaSize; i++) printf("%zu, ", total_homo_num_[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(".. son buf allocation number with only 1 son: %d\n", sonbufs_num1_);
|
printf(".. son buf allocation number with only 1 son: %zu\n", sonbufs_num1_);
|
||||||
printf(".. son buf allocation number with more than 1 son: %d\n", sonbufs_numgt1_);
|
printf(".. son buf allocation number with more than 1 son: %zu\n", sonbufs_numgt1_);
|
||||||
printf(".. total lemma node number: %d\n", total_lma_node_num_ + 1);
|
printf(".. total lemma node number: %zu\n", total_lma_node_num_ + 1);
|
||||||
}
|
}
|
||||||
#endif // ___DO_STATISTICS___
|
#endif // ___DO_STATISTICS___
|
||||||
|
|
||||||
|
@ -1307,7 +1307,7 @@ size_t MatrixSearch::extend_dmi(DictExtPara *dep, DictMatchInfo *dmi_s) {
|
|||||||
if (handles[1] > 0) {
|
if (handles[1] > 0) {
|
||||||
if (kPrintDebug0) {
|
if (kPrintDebug0) {
|
||||||
for (size_t t = 0; t < lpi_num; t++) {
|
for (size_t t = 0; t < lpi_num; t++) {
|
||||||
printf("--Extend in user dict: uid:%d uscore:%d\n", lpi_items_[lpi_total_ + t].id, lpi_items_[lpi_total_ + t].psb);
|
printf("--Extend in user dict: uid:%zu uscore:%d\n", lpi_items_[lpi_total_ + t].id, lpi_items_[lpi_total_ + t].psb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lpi_total_ += lpi_num;
|
lpi_total_ += lpi_num;
|
||||||
|
@ -103,7 +103,7 @@ void iterate_codes(double freqs[], size_t num, double code_book[], CODEBOOK_TYPE
|
|||||||
double delta = recalculate_kernel(freqs, num, code_book, code_idx);
|
double delta = recalculate_kernel(freqs, num, code_book, code_idx);
|
||||||
|
|
||||||
if (kPrintDebug0) {
|
if (kPrintDebug0) {
|
||||||
printf("---Unigram codebook iteration: %d : %d, %.9f\n", iter_num, changed, delta);
|
printf("---Unigram codebook iteration: %zu : %zu, %.9f\n", iter_num, changed, delta);
|
||||||
}
|
}
|
||||||
iter_num++;
|
iter_num++;
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ bool NGram::build_unigram(LemmaEntry *lemma_arr, size_t lemma_num, LemmaIdType n
|
|||||||
double log_score = log(freq_codes_df_[code_pos]);
|
double log_score = log(freq_codes_df_[code_pos]);
|
||||||
float final_score = convert_psb_to_score(freq_codes_df_[code_pos]);
|
float final_score = convert_psb_to_score(freq_codes_df_[code_pos]);
|
||||||
if (kPrintDebug0) {
|
if (kPrintDebug0) {
|
||||||
printf("code:%d, probability:%.9f, log score:%.3f, final score: %.3f\n", code_pos, freq_codes_df_[code_pos], log_score, final_score);
|
printf("code:%zu, probability:%.9f, log score:%.3f, final score: %.3f\n", code_pos, freq_codes_df_[code_pos], log_score, final_score);
|
||||||
}
|
}
|
||||||
freq_codes_[code_pos] = static_cast<LmaScoreType>(final_score);
|
freq_codes_[code_pos] = static_cast<LmaScoreType>(final_score);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ const char* SpellingTable::arrange(size_t* item_size, size_t* spl_num) {
|
|||||||
this_spl_buf[spelling_size_ - 1] = static_cast<char>((unsigned char)score);
|
this_spl_buf[spelling_size_ - 1] = static_cast<char>((unsigned char)score);
|
||||||
|
|
||||||
if (kPrintDebug0) {
|
if (kPrintDebug0) {
|
||||||
printf("---pos:%d, %s, psb:%d\n", pos, this_spl_buf, (unsigned char)this_spl_buf[spelling_size_ - 1]);
|
printf("---pos:%zu, %s, psb:%d\n", pos, this_spl_buf, (unsigned char)this_spl_buf[spelling_size_ - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
average_score /= spelling_num_;
|
average_score /= spelling_num_;
|
||||||
|
@ -292,7 +292,7 @@ bool SpellingTrie::construct(const char *spelling_arr, size_t item_size, size_t
|
|||||||
|
|
||||||
#ifdef ___BUILD_MODEL___
|
#ifdef ___BUILD_MODEL___
|
||||||
if (kPrintDebug0) {
|
if (kPrintDebug0) {
|
||||||
printf("---SpellingTrie Nodes: %d\n", node_num_);
|
printf("---SpellingTrie Nodes: %zu\n", node_num_);
|
||||||
}
|
}
|
||||||
return build_ym_info();
|
return build_ym_info();
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user