summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-01-11 17:09:50 +0800
committerPeng Wu <alexepico@gmail.com>2017-01-11 17:36:09 +0800
commitab4b8afebf5eba07ebf41c680816ee3d7bcca160 (patch)
treec05c7c846915e3dce0734ab35d0ca9f2fec8badf
parent0e9d2eb31f358089648b22b3976185d35206d006 (diff)
downloadlibpinyin-ab4b8afebf5eba07ebf41c680816ee3d7bcca160.tar.gz
libpinyin-ab4b8afebf5eba07ebf41c680816ee3d7bcca160.tar.xz
libpinyin-ab4b8afebf5eba07ebf41c680816ee3d7bcca160.zip
add comments
-rw-r--r--src/lookup/phonetic_lookup.h16
-rw-r--r--src/lookup/phonetic_lookup_heap.h2
2 files changed, 16 insertions, 2 deletions
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,14 +124,21 @@ 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<nbest> * 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 <gint32 nbest>
+bool extract_result(const ForwardPhoneticTrellis<nbest> * trellis,
+ const trellis_value_t * tail,
+ /* out */ MatchResults & result);
+
+#if 0
+template <gint32 nbest>
class BackwardPhoneticMatrix {
private:
/* Array of matrix_step */
@@ -138,10 +148,12 @@ public:
/* set tail node */
bool set_tail(const matrix_step<nbest> * 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 <gint32 nbest>
struct trellis_node {
private:
gint32 m_nelem;
+ /* invariant: min heap */
trellis_value_t m_elements[nbest];
public:
@@ -111,6 +112,7 @@ template <gint32 nbest>
struct matrix_step {
private:
gint32 m_nelem;
+ /* invariant: min heap */
matrix_value_t m_elements[nbest];
public: