summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lookup/phonetic_lookup_heap.h81
-rw-r--r--src/lookup/phonetic_lookup_linear.h45
2 files changed, 0 insertions, 126 deletions
diff --git a/src/lookup/phonetic_lookup_heap.h b/src/lookup/phonetic_lookup_heap.h
index 94f97d1..cd9e2bc 100644
--- a/src/lookup/phonetic_lookup_heap.h
+++ b/src/lookup/phonetic_lookup_heap.h
@@ -107,85 +107,4 @@ public:
};
-#if 0
-static inline bool matrix_value_more_than(const matrix_value_t &lhs,
- const matrix_value_t &rhs) {
- /* min heap here */
- return lhs.m_poss > rhs.m_poss;
-}
-
-template <gint32 nbest>
-struct matrix_step {
-private:
- gint32 m_nelem;
- /* invariant: min heap */
- matrix_value_t m_elements[nbest];
-
-public:
- matrix_step(){
- m_nelem = 0;
- /* always assume non-used m_elements contains random data. */
- }
-
-public:
- gint32 length() { return m_nelem; }
- const matrix_value_t * begin() { return m_elements; }
- const matrix_value_t * end() { return m_elements + m_nelem; }
-
- /* return true if the item is stored into m_elements. */
- bool eval_item(const matrix_value_t * item) {
- /* min heap here, and always push heap. */
-
- /* still have space */
- if (m_nelem < nbest) {
- m_elements[m_nelem] = *item;
- m_nelem ++;
- push_heap(begin(), end(), matrix_value_more_than);
- return true;
- }
-
- /* find minium item */
- matrix_value_t * min = m_elements;
-
- /* compare new item */
- if (item->m_poss > min->m_poss) {
- pop_heap(begin(), end(), matrix_value_more_than);
- m_elements[m_nelem - 1] = *item;
- push_heap(begin(), end(), matrix_value_more_than);
- return true;
- }
-
- return false;
- }
-};
-
-/* for space usage and performance. */
-/* as matrix step contains only one element,
- initialize with empty element. */
-template <>
-struct matrix_step <1> {
-private:
- matrix_value_t m_element;
-
-public:
- matrix_step <1> () : m_element(-FLT_MAX) {}
-
-public:
- gint32 length() { return 1; }
- const matrix_value_t * begin() { return &m_element; }
- const matrix_value_t * end() { return &m_element + 1; }
-
- /* return true if the item is stored into m_element. */
- bool eval_item(const matrix_value_t * item) {
- if (item->m_poss > m_element.m_poss) {
- m_element = *item;
- return true;
- }
-
- return false;
- }
-};
-#endif
-
-
#endif
diff --git a/src/lookup/phonetic_lookup_linear.h b/src/lookup/phonetic_lookup_linear.h
index 7abca66..9079c24 100644
--- a/src/lookup/phonetic_lookup_linear.h
+++ b/src/lookup/phonetic_lookup_linear.h
@@ -69,49 +69,4 @@ public:
}
};
-#if 0
-template <gint32 nbest>
-struct matrix_step {
-private:
- gint32 m_nelem;
- matrix_value_t m_elements[nbest];
-
-public:
- matrix_step(){
- m_nelem = 0;
- /* always assume non-used m_elements contains random data. */
- }
-
-public:
- gint32 length() { return m_nelem; }
- const matrix_value_t * begin() { return m_elements; }
- const matrix_value_t * end() { return m_elements + m_nelem; }
-
- /* return true if the item is stored into m_elements. */
- bool eval_item(const matrix_value_t * item) {
- /* still have space */
- if (m_nelem < nbest) {
- m_elements[m_nelem] = *item;
- m_nelem ++;
- return true;
- }
-
- /* find minium item */
- matrix_value_t * min = m_elements;
- for (gint32 i = 1; i < m_nelem; ++i) {
- if (min->m_poss > m_elements[i].m_poss)
- min = m_elements + i;
- }
-
- /* compare new item */
- if (item->m_poss > min->m_poss) {
- *min = *item;
- return true;
- }
-
- return false;
- }
-};
-#endif
-
#endif