summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-02-06 13:26:01 +0800
committerPeng Wu <alexepico@gmail.com>2017-02-06 13:31:04 +0800
commit0327c836a2ba39656fb1ec7f7e342a93aac665bb (patch)
tree0396eed67512516903bfd22d6f9bc60d95183617
parent1e698604f33ece6cbd3ee436aa6b9607003f3150 (diff)
downloadlibpinyin-0327c836a2ba39656fb1ec7f7e342a93aac665bb.tar.gz
libpinyin-0327c836a2ba39656fb1ec7f7e342a93aac665bb.tar.xz
libpinyin-0327c836a2ba39656fb1ec7f7e342a93aac665bb.zip
update PhoneticLookup
-rw-r--r--src/lookup/lookup.h5
-rw-r--r--src/lookup/phonetic_lookup.h14
-rw-r--r--src/lookup/phonetic_lookup_heap.h1
-rw-r--r--src/lookup/phonetic_lookup_linear.h1
4 files changed, 14 insertions, 7 deletions
diff --git a/src/lookup/lookup.h b/src/lookup/lookup.h
index 47fe204..1a7ad55 100644
--- a/src/lookup/lookup.h
+++ b/src/lookup/lookup.h
@@ -68,9 +68,10 @@ class FacadePhraseIndex;
* See also comments on lookup_value_t.
*/
-typedef GHashTable * LookupStepIndex;
/* Key: lookup_key_t, Value: int m, index to m_steps_content[i][m] */
-typedef GArray * LookupStepContent; /* array of lookup_value_t */
+typedef GHashTable * LookupStepIndex;
+/* Array of lookup_value_t or trellis_node */
+typedef GArray * LookupStepContent;
bool convert_to_utf8(FacadePhraseIndex * phrase_index,
MatchResult match_result,
diff --git a/src/lookup/phonetic_lookup.h b/src/lookup/phonetic_lookup.h
index 9a147ed..1108198 100644
--- a/src/lookup/phonetic_lookup.h
+++ b/src/lookup/phonetic_lookup.h
@@ -27,6 +27,7 @@
#include <math.h>
#include "phonetic_key_matrix.h"
#include "ngram.h"
+#include "lookup.h"
namespace pinyin{
@@ -131,11 +132,6 @@ struct trellis_constraint_t {
}
};
-typedef phrase_token_t lookup_key_t;
-/* Key: lookup_key_t, Value: int m, index to m_steps_content[i][m] */
-typedef GHashTable * LookupStepIndex;
-/* Array of trellis_node */
-typedef GArray * LookupStepContent;
/* use maximum heap to get the topest results. */
template<gint32 nbest>
@@ -921,6 +917,14 @@ public:
return true;
}
+
+ bool convert_to_utf8(MatchResult result,
+ /* out */ char * & result_string)
+ {
+ return pinyin::convert_to_utf8(m_phrase_index, result,
+ NULL, false, result_string);
+ }
+
};
};
diff --git a/src/lookup/phonetic_lookup_heap.h b/src/lookup/phonetic_lookup_heap.h
index ac25768..13a2360 100644
--- a/src/lookup/phonetic_lookup_heap.h
+++ b/src/lookup/phonetic_lookup_heap.h
@@ -49,6 +49,7 @@ public:
bool number() {
for (ssize_t i = 0; i < m_nelem; ++i)
m_elements[i].m_current_index = i;
+ return true;
}
/* return true if the item is stored into m_elements. */
diff --git a/src/lookup/phonetic_lookup_linear.h b/src/lookup/phonetic_lookup_linear.h
index 5cd745e..2ce8369 100644
--- a/src/lookup/phonetic_lookup_linear.h
+++ b/src/lookup/phonetic_lookup_linear.h
@@ -41,6 +41,7 @@ public:
bool number() {
for (ssize_t i = 0; i < m_nelem; ++i)
m_elements[i].m_current_index = i;
+ return true;
}
/* return true if the item is stored into m_elements. */