Skip to content

Commit

Permalink
Print Candidate Weights in API Console for Easy Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
graphemecluster committed Jul 22, 2024
1 parent 520a247 commit 9315986
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rime_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ static void rime_candidate_copy(RimeCandidate* dest, const an<Candidate>& src) {
} else {
dest->comment = nullptr;
}
dest->quality = src->quality();
dest->reserved = nullptr;
}

Expand Down
1 change: 1 addition & 0 deletions src/rime_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ typedef struct {
typedef struct rime_candidate_t {
char* text;
char* comment;
double quality;
void* reserved;
} RimeCandidate;

Expand Down
1 change: 1 addition & 0 deletions tools/rime_api_console.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ void print_menu(RimeMenu* menu) {
bool highlighted = i == menu->highlighted_candidate_index;
printf("%d. %c%s%c ", (i + 1) % 10, highlighted ? '[' : ' ',
menu->candidates[i].text, highlighted ? ']' : ' ');
printf("%f ", menu->candidates[i].quality);
print_comment(menu->candidates[i].comment);
putchar('\n');
}
Expand Down

0 comments on commit 9315986

Please sign in to comment.