summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-07-20 14:22:49 +0800
committerPeng Wu <alexepico@gmail.com>2011-07-20 14:22:49 +0800
commitde7ef0bad17a6b1925f99e69ff50bf14e77faeba (patch)
tree95b2a03e371df99a4c0e87b97a95191bc0e3f35e /utils
parentc87e5cef11df74817926d4cd097bbb49796684d3 (diff)
downloadlibpinyin-de7ef0bad17a6b1925f99e69ff50bf14e77faeba.tar.gz
libpinyin-de7ef0bad17a6b1925f99e69ff50bf14e77faeba.tar.xz
libpinyin-de7ef0bad17a6b1925f99e69ff50bf14e77faeba.zip
add error report to ngseg
Diffstat (limited to 'utils')
-rw-r--r--utils/segment/ngseg.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/segment/ngseg.cpp b/utils/segment/ngseg.cpp
index 1e3f6c5..87814bb 100644
--- a/utils/segment/ngseg.cpp
+++ b/utils/segment/ngseg.cpp
@@ -69,6 +69,15 @@ bool deal_with_segmentable(GArray * current_utf16){
g_phrase_lookup->convert_to_utf8(results, "\n", result_string);
if (result_string)
printf("%s\n", result_string);
+ else {
+ char * result_string = g_utf16_to_utf8
+ ( (utf16_t *) current_utf16->data, current_utf16->len,
+ NULL, NULL, NULL);
+ fprintf(stderr, "Un-segmentable sentence encountered:%s.\n",
+ result_string);
+ g_array_free(results, TRUE);
+ return false;
+ }
g_array_free(results, TRUE);
g_free(result_string);
return true;