summaryrefslogtreecommitdiffstats
path: root/src/lookup
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-02-07 13:38:09 +0800
committerPeng Wu <alexepico@gmail.com>2017-02-07 13:38:09 +0800
commit55d7fed35b663fa4acadc42e24a2175c228f7c37 (patch)
tree23502de338082c99c8e684f34ad46a8c58f90c8a /src/lookup
parent8df49857ef632ab03c290df8ee6abe9f436d1d3c (diff)
downloadlibpinyin-55d7fed35b663fa4acadc42e24a2175c228f7c37.tar.gz
libpinyin-55d7fed35b663fa4acadc42e24a2175c228f7c37.tar.xz
libpinyin-55d7fed35b663fa4acadc42e24a2175c228f7c37.zip
fixes compile again
Diffstat (limited to 'src/lookup')
-rw-r--r--src/lookup/phonetic_lookup.cpp3
-rw-r--r--src/lookup/phonetic_lookup.h14
2 files changed, 9 insertions, 8 deletions
diff --git a/src/lookup/phonetic_lookup.cpp b/src/lookup/phonetic_lookup.cpp
index 417ee9f..817f837 100644
--- a/src/lookup/phonetic_lookup.cpp
+++ b/src/lookup/phonetic_lookup.cpp
@@ -22,9 +22,6 @@
namespace pinyin{
-/* internal definition */
-static const size_t nbeam = 32;
-
bool dump_max_value(GPtrArray * values){
if (0 == values->len)
return false;
diff --git a/src/lookup/phonetic_lookup.h b/src/lookup/phonetic_lookup.h
index 078a467..6c349fb 100644
--- a/src/lookup/phonetic_lookup.h
+++ b/src/lookup/phonetic_lookup.h
@@ -31,6 +31,10 @@
namespace pinyin{
+
+/* internal definition */
+static const size_t nbeam = 32;
+
#define LONG_SENTENCE_PENALTY 1.2
struct trellis_value_t {
@@ -278,8 +282,8 @@ public:
node->number();
const trellis_value_t * value = node->begin();
- for (size_t j = 0; j < node->length(); ++j) {
- g_ptr_array_add(candidates, value);
+ for (gint32 j = 0; j < node->length(); ++j) {
+ g_ptr_array_add(candidates, (trellis_value_t *)value);
}
}
@@ -325,7 +329,7 @@ public:
get_candidates(tail_index, candidates);
get_top_results<nbest>(nbest, tails, candidates);
- g_ptr_array_sort(tails, trellis_value_compare);
+ g_ptr_array_sort(tails, (GCompareFunc)trellis_value_compare);
g_ptr_array_free(candidates, TRUE);
return true;
@@ -749,7 +753,7 @@ public:
continue;
m_trellis.get_candidates(i, candidates);
- get_top_results<nbest>(topresults, candidates);
+ get_top_results<nbest>(nbeam, topresults, candidates);
if (0 == topresults->len)
continue;
@@ -812,7 +816,7 @@ public:
const trellis_value_t * tail = (const trellis_value_t *)
g_ptr_array_index(tails, i);
- assert(extract_result<nbest>(m_trellis, tail, result));
+ assert(extract_result<nbest>(&m_trellis, tail, result));
results->add_result(result);
}