summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-01-02 11:21:13 +0800
committerPeng Wu <alexepico@gmail.com>2017-01-02 11:23:36 +0800
commit69e9e0b83e7a9aeb678dd7f564561541be7225ee (patch)
tree43c144573a16fa3aaf44b029ceefc965d82d275d
parentffddbe0f37fe64f60b943fc7dd8c9500c2f95f80 (diff)
downloadlibpinyin-69e9e0b83e7a9aeb678dd7f564561541be7225ee.tar.gz
libpinyin-69e9e0b83e7a9aeb678dd7f564561541be7225ee.tar.xz
libpinyin-69e9e0b83e7a9aeb678dd7f564561541be7225ee.zip
begin to write phonetic_lookup.h
-rw-r--r--src/lookup/phonetic_lookup.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/lookup/phonetic_lookup.h b/src/lookup/phonetic_lookup.h
new file mode 100644
index 0000000..4061195
--- /dev/null
+++ b/src/lookup/phonetic_lookup.h
@@ -0,0 +1,77 @@
+/*
+ * libpinyin
+ * Library to deal with pinyin.
+ *
+ * Copyright (C) 2017 Peng Wu <alexepico@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PHONETIC_LOOKUP_H
+#define PHONETIC_LOOKUP_H
+
+
+#include "novel_types.h"
+#include <limits.h>
+
+namespace pinyin{
+
+struct trellis_value_t {
+ phrase_token_t m_handles[2];
+ // the character length of the final sentence.
+ gint32 m_sentence_length;
+ gfloat m_poss;
+ // the m_last_step and m_last_index points to this trellis.
+ gint32 m_last_step;
+ gint32 m_last_index;
+};
+
+template <gint32 nbest>
+struct trellis_node {
+private:
+ gint32 m_nelem;
+ trellis_value_t m_elements[nbest];
+public:
+
+};
+
+struct matrix_value_t {
+ phrase_token_t m_cur_token;
+ gfloat m_poss;
+ // the below information for recovering the final phrase array.
+ // the m_next_step and m_next_index points to this matrix.
+ gint32 m_next_step;
+ gint32 m_next_index;
+};
+
+template <gint32 nbest>
+struct matrix_step {
+private:
+ gint32 m_nelem;
+ matrix_value_t m_elements[nbest];
+public:
+
+};
+
+struct trellis_constraint_t {
+ constraint_type m_type;
+ // expand the previous union into struct to catch some errors.
+ phrase_token_t m_token;
+ guint32 m_constraint_step;
+};
+
+
+};
+
+#endif