diff options
author | Peng Wu <alexepico@gmail.com> | 2011-08-08 15:24:51 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-08-08 15:24:51 +0800 |
commit | 3de71392c23ff1012b9c38a03e6a53942eb704d5 (patch) | |
tree | ef197587359d76c182aaffb661d60a9bedcec239 /src/lookup | |
parent | e44f8dc3df4766331b4d4296fd2cf7f88f70145a (diff) | |
download | libpinyin-3de71392c23ff1012b9c38a03e6a53942eb704d5.tar.gz libpinyin-3de71392c23ff1012b9c38a03e6a53942eb704d5.tar.xz libpinyin-3de71392c23ff1012b9c38a03e6a53942eb704d5.zip |
refine namespace pinyin
Diffstat (limited to 'src/lookup')
-rw-r--r-- | src/lookup/lookup.h | 15 | ||||
-rw-r--r-- | src/lookup/phrase_lookup.cpp | 2 | ||||
-rw-r--r-- | src/lookup/phrase_lookup.h | 4 | ||||
-rw-r--r-- | src/lookup/pinyin_lookup.cpp | 2 | ||||
-rw-r--r-- | src/lookup/pinyin_lookup.h | 3 | ||||
-rw-r--r-- | src/lookup/winner_tree.cpp | 2 | ||||
-rw-r--r-- | src/lookup/winner_tree.h | 3 |
7 files changed, 24 insertions, 7 deletions
diff --git a/src/lookup/lookup.h b/src/lookup/lookup.h index fc98f95..8076d54 100644 --- a/src/lookup/lookup.h +++ b/src/lookup/lookup.h @@ -26,6 +26,8 @@ * @brief the definitions of common lookup related classes and structs. */ +namespace pinyin{ + typedef phrase_token_t lookup_key_t; struct lookup_value_t{ @@ -43,14 +45,12 @@ struct lookup_value_t{ } }; -namespace pinyin{ - class PinyinLargeTable; - class PhraseLargeTable; - class FacadePhraseIndex; - class Bigram; -}; -using namespace pinyin; +class PinyinLargeTable; +class PhraseLargeTable; +class FacadePhraseIndex; +class Bigram; + /* Note: * LookupStepIndex: @@ -68,4 +68,5 @@ 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 */ +}; #endif diff --git a/src/lookup/phrase_lookup.cpp b/src/lookup/phrase_lookup.cpp index c51fabc..c176773 100644 --- a/src/lookup/phrase_lookup.cpp +++ b/src/lookup/phrase_lookup.cpp @@ -27,6 +27,8 @@ #include "ngram.h" #include "phrase_lookup.h" +using namespace pinyin; + const gfloat PhraseLookup::bigram_lambda; const gfloat PhraseLookup::unigram_lambda; diff --git a/src/lookup/phrase_lookup.h b/src/lookup/phrase_lookup.h index 61c5487..495e44e 100644 --- a/src/lookup/phrase_lookup.h +++ b/src/lookup/phrase_lookup.h @@ -29,6 +29,8 @@ * @brief the definitions of phrase lookup related classes and structs. */ +namespace pinyin{ + class PhraseLookup{ private: static const gfloat bigram_lambda = LAMBDA_PARAMETER; @@ -80,4 +82,6 @@ public: bool convert_to_utf8(MatchResults results, /* in */ const char * delimiter, /* out */ char * & result_string); }; +}; + #endif diff --git a/src/lookup/pinyin_lookup.cpp b/src/lookup/pinyin_lookup.cpp index 8264127..10d61b4 100644 --- a/src/lookup/pinyin_lookup.cpp +++ b/src/lookup/pinyin_lookup.cpp @@ -32,6 +32,8 @@ #include "pinyin_lookup.h" #include "winner_tree.h" +using namespace pinyin; + const gfloat PinyinLookup::bigram_lambda; const gfloat PinyinLookup::unigram_lambda; diff --git a/src/lookup/pinyin_lookup.h b/src/lookup/pinyin_lookup.h index 980b23d..b8f2e58 100644 --- a/src/lookup/pinyin_lookup.h +++ b/src/lookup/pinyin_lookup.h @@ -28,6 +28,8 @@ #include "pinyin_base.h" #include "lookup.h" +namespace pinyin{ + class WinnerTree; /** @file pinyin_lookup.h @@ -139,4 +141,5 @@ public: bool destroy_pinyin_lookup(PhraseIndexRanges ranges); }; +}; #endif diff --git a/src/lookup/winner_tree.cpp b/src/lookup/winner_tree.cpp index da87951..29135f5 100644 --- a/src/lookup/winner_tree.cpp +++ b/src/lookup/winner_tree.cpp @@ -27,6 +27,8 @@ #include "pinyin_lookup.h" #include "winner_tree.h" +using namespace pinyin; + WinnerTreeBranchIterator::WinnerTreeBranchIterator(WinnerTree & tree) :m_tree(tree), m_counter(0){ m_max_value = m_tree.m_items[m_tree.get_winner()]; diff --git a/src/lookup/winner_tree.h b/src/lookup/winner_tree.h index 0d9bfa2..0559589 100644 --- a/src/lookup/winner_tree.h +++ b/src/lookup/winner_tree.h @@ -24,6 +24,8 @@ #include <assert.h> +namespace pinyin{ + const int nbranch = 32; class DirectBranchIterator: public IBranchIterator{//for nitem <= nbranch @@ -143,4 +145,5 @@ protected: void replay(int i); }; +}; #endif |