From ab4b8afebf5eba07ebf41c680816ee3d7bcca160 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 11 Jan 2017 17:09:50 +0800 Subject: add comments --- src/lookup/phonetic_lookup.h | 16 ++++++++++++++-- src/lookup/phonetic_lookup_heap.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lookup/phonetic_lookup.h b/src/lookup/phonetic_lookup.h index 0ea9b68..59110e5 100644 --- a/src/lookup/phonetic_lookup.h +++ b/src/lookup/phonetic_lookup.h @@ -51,8 +51,10 @@ struct trellis_value_t { } }; +#if 0 struct matrix_value_t { phrase_token_t m_cur_token; + /* just propagate the value from tail matrix step. */ gfloat m_poss; // the below information for recovering the final phrase array. // the m_next_step and m_next_index points to this matrix. @@ -67,6 +69,7 @@ struct matrix_value_t { m_next_index = -1; } }; +#endif #if 1 /* for debug purpose */ @@ -121,13 +124,20 @@ public: /* insert candidate */ bool insert_candidate(gint32 index, phrase_token_t token, const trellis_value_t * candidate); - /* get tail node */ - bool get_tail(/* out */ matrix_step * tail) const; + /* get tails */ + /* Array of trellis_value_t */ + bool get_tails(/* out */ GArray * tails) const; /* get candidate */ bool get_candidate(gint32 index, phrase_token_t token, gint32 last_index, trellis_value_t * candidate) const; }; +template +bool extract_result(const ForwardPhoneticTrellis * trellis, + const trellis_value_t * tail, + /* out */ MatchResults & result); + +#if 0 template class BackwardPhoneticMatrix { private: @@ -138,10 +148,12 @@ public: /* set tail node */ bool set_tail(const matrix_step * tail); /* back trace */ + /* always assume/assert matrix_step.eval_item(...) return true? */ bool back_trace(const ForwardPhoneticTrellis * trellis); /* extract results */ int extract(/* out */ GPtrArray * arrays); }; +#endif class ForwardPhoneticConstraints { private: diff --git a/src/lookup/phonetic_lookup_heap.h b/src/lookup/phonetic_lookup_heap.h index bc432a9..3a3d596 100644 --- a/src/lookup/phonetic_lookup_heap.h +++ b/src/lookup/phonetic_lookup_heap.h @@ -31,6 +31,7 @@ template struct trellis_node { private: gint32 m_nelem; + /* invariant: min heap */ trellis_value_t m_elements[nbest]; public: @@ -111,6 +112,7 @@ template struct matrix_step { private: gint32 m_nelem; + /* invariant: min heap */ matrix_value_t m_elements[nbest]; public: -- cgit