29 if (word_alt_ != NULL) {
30 for (
int alt_idx = 0; alt_idx <
alt_cnt_; alt_idx++) {
31 if (word_alt_[alt_idx] != NULL) {
32 delete []word_alt_[alt_idx];
44 if (word_alt_ == NULL ||
alt_cost_ == NULL) {
51 for (
int alt_idx = 0; alt_idx <
alt_cnt_; alt_idx++) {
69 memcpy(word_alt_[
alt_cnt_], word_str, len *
sizeof(*word_str));
85 for (
int alt_idx = 0; alt_idx <
alt_cnt_; alt_idx++) {
86 for (
int alt = alt_idx + 1; alt <
alt_cnt_; alt++) {
88 char_32 *pchTemp = word_alt_[alt_idx];
89 word_alt_[alt_idx] = word_alt_[alt];
90 word_alt_[alt] = pchTemp;
105 for (
int alt_idx = 0; alt_idx <
alt_cnt_; alt_idx++) {
106 char_32 *word_32 = word_alt_[alt_idx];
110 fprintf(stderr,
"Alt[%d]=%s (cost=%d, num_unichars=%d); unichars=", alt_idx,
111 word_str.c_str(),
alt_cost_[alt_idx], num_unichars);
112 for (
int i = 0; i < num_unichars; ++i)
113 fprintf(stderr,
"%d ", word_32[i]);
114 fprintf(stderr,
"\n");
static void UTF32ToUTF8(const char_32 *utf32_str, string *str)
static int StrLen(const char_32 *str)
static int StrCmp(const char_32 *str1, const char_32 *str2)
bool Insert(char_32 *char_ptr, int cost, void *tag=NULL)