summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-01-10 12:46:11 +0800
committerPeng Wu <alexepico@gmail.com>2012-01-10 12:46:11 +0800
commit742de0a367e511388ff197f6c21d586877698dda (patch)
tree5df5ee074654c61ae45f2cf4a66b40b25089f9a4
parent18e2714d4c67d55d9c054f8087b297e7862b433f (diff)
downloadlibpinyin-742de0a367e511388ff197f6c21d586877698dda.tar.gz
libpinyin-742de0a367e511388ff197f6c21d586877698dda.tar.xz
libpinyin-742de0a367e511388ff197f6c21d586877698dda.zip
begin to use facade * table
-rw-r--r--src/lookup/lookup.h4
-rw-r--r--src/lookup/phrase_lookup.cpp4
-rw-r--r--src/lookup/phrase_lookup.h4
-rw-r--r--src/lookup/pinyin_lookup.cpp3
-rw-r--r--src/lookup/pinyin_lookup.h5
-rw-r--r--src/pinyin.cpp13
6 files changed, 17 insertions, 16 deletions
diff --git a/src/lookup/lookup.h b/src/lookup/lookup.h
index 0fc590b..7cac0d9 100644
--- a/src/lookup/lookup.h
+++ b/src/lookup/lookup.h
@@ -49,8 +49,8 @@ struct lookup_value_t{
};
-class PinyinLargeTable;
-class PhraseLargeTable;
+class FacadeChewingTable;
+class FacadePhraseTable;
class FacadePhraseIndex;
class Bigram;
diff --git a/src/lookup/phrase_lookup.cpp b/src/lookup/phrase_lookup.cpp
index 53d43b3..28702c2 100644
--- a/src/lookup/phrase_lookup.cpp
+++ b/src/lookup/phrase_lookup.cpp
@@ -23,7 +23,7 @@
#include "stl_lite.h"
#include "novel_types.h"
#include "phrase_index.h"
-#include "phrase_large_table.h"
+#include "facade_phrase_table.h"
#include "ngram.h"
#include "phrase_lookup.h"
@@ -32,7 +32,7 @@ using namespace pinyin;
const gfloat PhraseLookup::bigram_lambda = LAMBDA_PARAMETER;
const gfloat PhraseLookup::unigram_lambda = 1 - LAMBDA_PARAMETER;
-PhraseLookup::PhraseLookup(PhraseLargeTable * phrase_table,
+PhraseLookup::PhraseLookup(FacadePhraseTable * phrase_table,
FacadePhraseIndex * phrase_index,
Bigram * system_bigram,
Bigram * user_bigram){
diff --git a/src/lookup/phrase_lookup.h b/src/lookup/phrase_lookup.h
index a989648..dd1ddc8 100644
--- a/src/lookup/phrase_lookup.h
+++ b/src/lookup/phrase_lookup.h
@@ -39,7 +39,7 @@ private:
PhraseItem m_cache_phrase_item;
protected:
//saved varibles
- PhraseLargeTable * m_phrase_table;
+ FacadePhraseTable * m_phrase_table;
FacadePhraseIndex * m_phrase_index;
Bigram * m_system_bigram;
Bigram * m_user_bigram;
@@ -68,7 +68,7 @@ protected:
bool final_step(MatchResults & results);
public:
- PhraseLookup(PhraseLargeTable * phrase_table,
+ PhraseLookup(FacadePhraseTable * phrase_table,
FacadePhraseIndex * phrase_index,
Bigram * system_bigram,
Bigram * user_bigram);
diff --git a/src/lookup/pinyin_lookup.cpp b/src/lookup/pinyin_lookup.cpp
index efad86f..97507d3 100644
--- a/src/lookup/pinyin_lookup.cpp
+++ b/src/lookup/pinyin_lookup.cpp
@@ -26,6 +26,7 @@
#include "stl_lite.h"
#include "novel_types.h"
#include "pinyin_phrase2.h"
+#include "facade_chewing_table.h"
#include "ngram.h"
#include "winner_tree.h"
@@ -35,7 +36,7 @@ const gfloat PinyinLookup::bigram_lambda = LAMBDA_PARAMETER;
const gfloat PinyinLookup::unigram_lambda = 1 - LAMBDA_PARAMETER;
PinyinLookup::PinyinLookup(pinyin_option_t options,
- ChewingLargeTable * pinyin_table,
+ FacadeChewingTable * pinyin_table,
FacadePhraseIndex * phrase_index,
Bigram * system_bigram,
Bigram * user_bigram){
diff --git a/src/lookup/pinyin_lookup.h b/src/lookup/pinyin_lookup.h
index ec30957..32995e4 100644
--- a/src/lookup/pinyin_lookup.h
+++ b/src/lookup/pinyin_lookup.h
@@ -28,7 +28,6 @@
#include "novel_types.h"
#include "chewing_key.h"
#include "phrase_index.h"
-#include "chewing_large_table.h"
#include "lookup.h"
@@ -90,7 +89,7 @@ protected:
CandidateConstraints m_constraints;
ChewingKeyVector m_keys;
- ChewingLargeTable * m_pinyin_table;
+ FacadeChewingTable * m_pinyin_table;
FacadePhraseIndex * m_phrase_index;
pinyin_option_t m_options;
Bigram * m_system_bigram;
@@ -122,7 +121,7 @@ protected:
bool final_step(MatchResults & results);
public:
- PinyinLookup(pinyin_option_t options, ChewingLargeTable * pinyin_table,
+ PinyinLookup(pinyin_option_t options, FacadeChewingTable * pinyin_table,
FacadePhraseIndex * phrase_index, Bigram * system_bigram,
Bigram * user_bigram);
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 3663904..14b3604 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -33,8 +33,8 @@ struct _pinyin_context_t{
DoublePinyinParser2 * m_double_pinyin_parser;
ChewingParser2 * m_chewing_parser;
- ChewingLargeTable * m_pinyin_table;
- PhraseLargeTable * m_phrase_table;
+ FacadeChewingTable * m_pinyin_table;
+ FacadePhraseTable * m_phrase_table;
FacadePhraseIndex * m_phrase_index;
Bigram * m_system_bigram;
Bigram * m_user_bigram;
@@ -106,7 +106,7 @@ pinyin_context_t * pinyin_init(const char * systemdir, const char * userdir){
check_format(context->m_user_dir);
- context->m_pinyin_table = new ChewingLargeTable(context->m_options);
+ context->m_pinyin_table = new FacadeChewingTable;
MemoryChunk * chunk = new MemoryChunk;
gchar * filename = g_build_filename
(context->m_system_dir, "pinyin_index.bin", NULL);
@@ -115,13 +115,14 @@ pinyin_context_t * pinyin_init(const char * systemdir, const char * userdir){
return NULL;
}
g_free(filename);
- context->m_pinyin_table->load(chunk);
+
+ context->m_pinyin_table->load(context->m_options, chunk, NULL);
context->m_full_pinyin_parser = new FullPinyinParser2;
context->m_double_pinyin_parser = new DoublePinyinParser2;
context->m_chewing_parser = new ChewingParser2;
- context->m_phrase_table = new PhraseLargeTable;
+ context->m_phrase_table = new FacadePhraseTable;
chunk = new MemoryChunk;
filename = g_build_filename(context->m_system_dir, "phrase_index.bin", NULL);
if (!chunk->load(filename)) {
@@ -129,7 +130,7 @@ pinyin_context_t * pinyin_init(const char * systemdir, const char * userdir){
return NULL;
}
g_free(filename);
- context->m_phrase_table->load(chunk);
+ context->m_phrase_table->load(chunk, NULL);
context->m_phrase_index = new FacadePhraseIndex;
MemoryChunk * log = new MemoryChunk; chunk = new MemoryChunk;