From 44e570de46e39b5e1ccc4133414cf8ae19e1868b Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 8 Feb 2017 12:42:22 +0800 Subject: rename variables --- src/lookup/phonetic_lookup.h | 18 +++++++++--------- src/lookup/phonetic_lookup_heap.h | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/lookup') diff --git a/src/lookup/phonetic_lookup.h b/src/lookup/phonetic_lookup.h index f7d49af..c90c994 100644 --- a/src/lookup/phonetic_lookup.h +++ b/src/lookup/phonetic_lookup.h @@ -62,28 +62,28 @@ struct trellis_value_t { }; template -static bool inline trellis_value_less_than(const trellis_value_t * exist_item, - const trellis_value_t * new_item) { +static bool inline trellis_value_less_than(const trellis_value_t * item_lhs, + const trellis_value_t * item_rhs) { #if 1 if (nbest > 1) { /* allow longer sentence */ - if (exist_item->m_sentence_length + 1 == new_item->m_sentence_length && - exist_item->m_poss + LONG_SENTENCE_PENALTY < new_item->m_poss) + if (item_lhs->m_sentence_length + 1 == item_rhs->m_sentence_length && + item_lhs->m_poss + LONG_SENTENCE_PENALTY < item_rhs->m_poss) return true; - if (exist_item->m_sentence_length == new_item->m_sentence_length + 1 && - exist_item->m_poss < new_item->m_poss + LONG_SENTENCE_PENALTY) + if (item_lhs->m_sentence_length == item_rhs->m_sentence_length + 1 && + item_lhs->m_poss < item_rhs->m_poss + LONG_SENTENCE_PENALTY) return true; } #endif /* the same length but better possibility */ - if (exist_item->m_sentence_length == new_item->m_sentence_length && - exist_item->m_poss < new_item->m_poss) + if (item_lhs->m_sentence_length == item_rhs->m_sentence_length && + item_lhs->m_poss < item_rhs->m_poss) return true; /* shorter sentence */ - if (exist_item->m_sentence_length > new_item->m_sentence_length) + if (item_lhs->m_sentence_length > item_rhs->m_sentence_length) return true; return false; diff --git a/src/lookup/phonetic_lookup_heap.h b/src/lookup/phonetic_lookup_heap.h index be1bcea..73eac28 100644 --- a/src/lookup/phonetic_lookup_heap.h +++ b/src/lookup/phonetic_lookup_heap.h @@ -22,10 +22,10 @@ #define PHONETIC_LOOKUP_HEAP_H template -static inline bool trellis_value_comp(const trellis_value_t &exist_item, - const trellis_value_t &new_item) { +static inline bool trellis_value_comp(const trellis_value_t &lhs, + const trellis_value_t &rhs) { /* min heap here */ - return trellis_value_less_than(&exist_item, &new_item); + return trellis_value_less_than(&lhs, &rhs); } template @@ -55,12 +55,13 @@ public: /* return true if the item is stored into m_elements. */ bool eval_item(const trellis_value_t * item) { - /* min heap here, and always push heap. */ + /* min heap here. */ /* still have space */ if (m_nelem < nbest) { m_elements[m_nelem] = *item; m_nelem ++; + /* always push heap. */ std_lite::push_heap(m_elements, m_elements + m_nelem, trellis_value_comp); return true; } -- cgit