diff options
Diffstat (limited to 'src/lookup/phonetic_lookup.h')
-rw-r--r-- | src/lookup/phonetic_lookup.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lookup/phonetic_lookup.h b/src/lookup/phonetic_lookup.h index 2489087..c54f483 100644 --- a/src/lookup/phonetic_lookup.h +++ b/src/lookup/phonetic_lookup.h @@ -171,6 +171,12 @@ bool get_top_results(size_t num, return true; } +static gint trellis_value_compare(const trellis_value_t ** lhs, + const trellis_value_t ** rhs) { + /* in descending order */ + return -((*lhs)->m_poss - (*rhs)->m_poss); +} + template <gint32 nbest> class ForwardPhoneticTrellis { private: @@ -324,6 +330,8 @@ public: get_candidates(tail_index, candidates); get_top_results<nbest>(nbest, tails, candidates); + g_ptr_array_sort(tails, trellis_value_compare); + g_ptr_array_free(candidates, TRUE); return true; } |