summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/storage/import_interpolation.cpp11
-rw-r--r--utils/training/import_k_mixture_model.cpp2
2 files changed, 9 insertions, 4 deletions
diff --git a/utils/storage/import_interpolation.cpp b/utils/storage/import_interpolation.cpp
index d1d60e2..205a27a 100644
--- a/utils/storage/import_interpolation.cpp
+++ b/utils/storage/import_interpolation.cpp
@@ -188,20 +188,23 @@ bool parse_bigram(FILE * input, PhraseLargeTable2 * phrase_table,
if ( last_token && last_single_gram ) {
bigram->store(last_token, last_single_gram);
delete last_single_gram;
- //safe guard
- last_token = 0;
+
+ /* safe guard */
+ last_token = null_token;
last_single_gram = NULL;
}
SingleGram * single_gram = NULL;
bigram->load(token1, single_gram);
- //create the new single gram
+ /* create the new single gram */
if ( single_gram == NULL )
single_gram = new SingleGram;
last_token = token1;
last_single_gram = single_gram;
}
- //save the freq
+
+ /* save the freq */
+ assert(NULL != last_single_gram);
guint32 total_freq = 0;
assert(last_single_gram->get_total_freq(total_freq));
assert(last_single_gram->insert_freq(token2, count));
diff --git a/utils/training/import_k_mixture_model.cpp b/utils/training/import_k_mixture_model.cpp
index d018b78..40870cf 100644
--- a/utils/training/import_k_mixture_model.cpp
+++ b/utils/training/import_k_mixture_model.cpp
@@ -231,6 +231,8 @@ bool parse_bigram(FILE * input, PhraseLargeTable2 * phrase_table,
last_token = token1;
last_single_gram = single_gram;
}
+
+ assert(NULL != last_single_gram);
assert(last_single_gram->insert_array_item(token2, array_item));
break;
}