For showing all chunks
| 409 | |
| 410 | // For showing all chunks |
| 411 | void CLD2_Debug2(const char* text, |
| 412 | bool more_to_come, bool score_cjk, |
| 413 | const ScoringHitBuffer* hitbuffer, |
| 414 | const ScoringContext* scoringcontext, |
| 415 | const SummaryBuffer* summarybuffer) { |
| 416 | FILE* df = scoringcontext->debug_file; |
| 417 | if (df == NULL) {return;} |
| 418 | uint16 prior_chunk_lang = static_cast<uint16>(UNKNOWN_LANGUAGE); |
| 419 | |
| 420 | for (int i = 0; i < summarybuffer->n; ++i) { |
| 421 | fprintf(df, "Debug2[%d] ", i); |
| 422 | const ChunkSummary* chunksummary = &summarybuffer->chunksummary[i]; |
| 423 | // Print annotated colored text of this chunk |
| 424 | bool is_reliable = true; |
| 425 | bool match_prior = false; |
| 426 | int reliable = CLD2::minint(chunksummary->reliability_delta, |
| 427 | chunksummary->reliability_score); |
| 428 | is_reliable = (reliable >= 75); |
| 429 | match_prior = (chunksummary->lang1 == prior_chunk_lang); |
| 430 | if (!is_reliable) {match_prior = false;} |
| 431 | |
| 432 | if (match_prior) { |
| 433 | fprintf(df, "[]"); |
| 434 | } else if (is_reliable) { |
| 435 | fprintf(df, "[%s]", |
| 436 | LanguageCode(static_cast<Language>(chunksummary->lang1))); |
| 437 | } else { |
| 438 | fprintf(df, "[%s*.%d/%s.%d]", |
| 439 | LanguageCode(static_cast<Language>(chunksummary->lang1)), |
| 440 | chunksummary->score1, |
| 441 | LanguageCode(static_cast<Language>(chunksummary->lang2)), |
| 442 | chunksummary->score2); |
| 443 | } |
| 444 | |
| 445 | int lo_offset = chunksummary->offset; |
| 446 | int chunktext_len = chunksummary->bytes; |
| 447 | string chunk_text(&text[lo_offset], chunktext_len); |
| 448 | |
| 449 | Language lang = static_cast<Language>(chunksummary->lang1); |
| 450 | fprintf(df, " <span style=\"background:#%06X;color:#%06X;\">\n", |
| 451 | GetBackColor(lang, false), |
| 452 | GetTextColor(lang, false)); |
| 453 | fprintf(df, "%s", chunk_text.c_str()); |
| 454 | if (scoringcontext->flags_cld2_cr) { |
| 455 | fprintf(df, "</span><br>\n"); |
| 456 | } else { |
| 457 | fprintf(df, "</span> \n"); |
| 458 | } |
| 459 | prior_chunk_lang = chunksummary->lang1; |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | void DumpResultChunkVector(FILE* f, const char* src, |
| 464 | ResultChunkVector* resultchunkvector) { |
nothing calls this directly
no test coverage detected