MCPcopy Create free account
hub / github.com/aboSamoor/pycld2 / ProcessHitBuffer

Function ProcessHitBuffer

cld2/internal/scoreonescriptspan.cc:1067–1116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1065// sweep, etc.
1066
1067void ProcessHitBuffer(const LangSpan& scriptspan,
1068 int letter_offset,
1069 ScoringContext* scoringcontext,
1070 DocTote* doc_tote,
1071 ResultChunkVector* vec,
1072 bool more_to_come, bool score_cjk,
1073 ScoringHitBuffer* hitbuffer) {
1074 if (scoringcontext->flags_cld2_verbose) {
1075 fprintf(scoringcontext->debug_file, "Hitbuffer[) ");
1076 DumpHitBuffer(scoringcontext->debug_file, scriptspan.text, hitbuffer);
1077 }
1078
1079 LinearizeHitBuffer(letter_offset, scoringcontext, more_to_come, score_cjk,
1080 hitbuffer);
1081
1082 if (scoringcontext->flags_cld2_verbose) {
1083 fprintf(scoringcontext->debug_file, "Linear[) ");
1084 DumpLinearBuffer(scoringcontext->debug_file, scriptspan.text, hitbuffer);
1085 }
1086
1087 SummaryBuffer summarybuffer;
1088 summarybuffer.n = 0;
1089 ChunkSpan last_cspan;
1090 ScoreAllHits(scriptspan.text, scriptspan.ulscript,
1091 more_to_come, score_cjk, hitbuffer,
1092 scoringcontext,
1093 &summarybuffer, &last_cspan);
1094
1095 if (scoringcontext->flags_cld2_verbose) {
1096 DumpSummaryBuffer(scoringcontext->debug_file, &summarybuffer);
1097 }
1098
1099 if (vec != NULL) {
1100 // Sharpen boundaries of summarybuffer
1101 // This is not a high-performance path
1102 SharpenBoundaries(scriptspan.text, more_to_come, hitbuffer, scoringcontext,
1103 &summarybuffer);
1104 // Show after the sharpening
1105 // CLD2_Debug2(scriptspan.text, more_to_come, score_cjk,
1106 // hitbuffer, scoringcontext, &summarybuffer);
1107
1108 if (scoringcontext->flags_cld2_verbose) {
1109 DumpSummaryBuffer(scoringcontext->debug_file, &summarybuffer);
1110 }
1111 }
1112
1113 SummaryBufferToDocTote(&summarybuffer, more_to_come, doc_tote);
1114 SummaryBufferToVector(scoringcontext->scanner, scriptspan.text,
1115 &summarybuffer, more_to_come, vec);
1116}
1117
1118void SpliceHitBuffer(ScoringHitBuffer* hitbuffer, int next_offset) {
1119 // Splice hitbuffer and summarybuffer for next round. With big chunks and

Callers 2

ScoreCJKScriptSpanFunction · 0.85
ScoreQuadScriptSpanFunction · 0.85

Calls 8

DumpHitBufferFunction · 0.85
LinearizeHitBufferFunction · 0.85
DumpLinearBufferFunction · 0.85
ScoreAllHitsFunction · 0.85
DumpSummaryBufferFunction · 0.85
SharpenBoundariesFunction · 0.85
SummaryBufferToDocToteFunction · 0.85
SummaryBufferToVectorFunction · 0.85

Tested by

no test coverage detected