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 | |
parent | e44f8dc3df4766331b4d4296fd2cf7f88f70145a (diff) | |
download | libpinyin-3de71392c23ff1012b9c38a03e6a53942eb704d5.tar.gz libpinyin-3de71392c23ff1012b9c38a03e6a53942eb704d5.tar.xz libpinyin-3de71392c23ff1012b9c38a03e6a53942eb704d5.zip |
refine namespace pinyin
-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 | ||||
-rw-r--r-- | src/pinyin.h | 2 | ||||
-rw-r--r-- | src/storage/ngram.cpp | 2 | ||||
-rw-r--r-- | src/storage/ngram.h | 3 | ||||
-rw-r--r-- | src/storage/phrase_index.cpp | 2 | ||||
-rw-r--r-- | src/storage/phrase_index.h | 12 | ||||
-rw-r--r-- | src/storage/phrase_large_table.h | 2 | ||||
-rw-r--r-- | src/storage/pinyin_base.cpp | 2 | ||||
-rw-r--r-- | src/storage/pinyin_base.h | 2 | ||||
-rw-r--r-- | src/storage/pinyin_large_table.h | 1 | ||||
-rw-r--r-- | src/storage/pinyin_phrase.h | 2 | ||||
-rw-r--r-- | src/storage/tag_utility.cpp | 2 | ||||
-rw-r--r-- | src/storage/tag_utility.h | 3 |
19 files changed, 39 insertions, 27 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 diff --git a/src/pinyin.h b/src/pinyin.h index a360a3c..88f1fb5 100644 --- a/src/pinyin.h +++ b/src/pinyin.h @@ -15,4 +15,6 @@ /* training module */ #include "flexible_ngram.h" +using namespace pinyin; + typedef struct _pinyin_context_t pinyin_context_t; diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp index 35aea0c..a4d72c2 100644 --- a/src/storage/ngram.cpp +++ b/src/storage/ngram.cpp @@ -26,6 +26,8 @@ #include "novel_types.h" #include "ngram.h" +using namespace pinyin; + struct SingleGramItem{ phrase_token_t m_token; guint32 m_freq; diff --git a/src/storage/ngram.h b/src/storage/ngram.h index f8b59f1..1f891d0 100644 --- a/src/storage/ngram.h +++ b/src/storage/ngram.h @@ -132,7 +132,4 @@ public: }; -using namespace pinyin; - - #endif diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp index 364601e..33da334 100644 --- a/src/storage/phrase_index.cpp +++ b/src/storage/phrase_index.cpp @@ -21,6 +21,8 @@ #include "phrase_index.h" +using namespace pinyin; + bool PhraseItem::set_n_pronunciation(guint8 n_prouns){ m_chunk.set_content(sizeof(guint8), &n_prouns, sizeof(guint8)); return true; diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h index d7fd4bc..ccabc9b 100644 --- a/src/storage/phrase_index.h +++ b/src/storage/phrase_index.h @@ -44,10 +44,10 @@ * ++++++++++++++++++++++++++++++++++++++++++ */ -class PinyinLookup; - namespace pinyin{ +class PinyinLookup; + /* Because this is not large, * Store this in user home directory. */ @@ -185,7 +185,7 @@ public: }; class FacadePhraseIndex{ - friend class ::PinyinLookup; + friend class PinyinLookup; private: guint32 m_total_freq; SubPhraseIndex * m_sub_phrase_indices[PHRASE_INDEX_LIBRARY_COUNT]; @@ -265,10 +265,4 @@ public: }; -using namespace pinyin; - - - - - #endif diff --git a/src/storage/phrase_large_table.h b/src/storage/phrase_large_table.h index 423c457..6e14d2e 100644 --- a/src/storage/phrase_large_table.h +++ b/src/storage/phrase_large_table.h @@ -106,6 +106,4 @@ public: }; -using namespace pinyin; - #endif diff --git a/src/storage/pinyin_base.cpp b/src/storage/pinyin_base.cpp index e7715a0..7e2f805 100644 --- a/src/storage/pinyin_base.cpp +++ b/src/storage/pinyin_base.cpp @@ -25,6 +25,8 @@ #include "pinyin_phrase.h" #include "pinyin_large_table.h" +using namespace pinyin; + // Internal data definition /** diff --git a/src/storage/pinyin_base.h b/src/storage/pinyin_base.h index 14d3a99..56b260f 100644 --- a/src/storage/pinyin_base.h +++ b/src/storage/pinyin_base.h @@ -723,6 +723,4 @@ int pinyin_compare_tone (const PinyinCustomSettings &custom, PinyinTone rhs); }; -using namespace pinyin; - #endif diff --git a/src/storage/pinyin_large_table.h b/src/storage/pinyin_large_table.h index 83f4de9..2ef862d 100644 --- a/src/storage/pinyin_large_table.h +++ b/src/storage/pinyin_large_table.h @@ -134,5 +134,4 @@ public: }; -using namespace pinyin; #endif diff --git a/src/storage/pinyin_phrase.h b/src/storage/pinyin_phrase.h index cbcb742..df6f26a 100644 --- a/src/storage/pinyin_phrase.h +++ b/src/storage/pinyin_phrase.h @@ -294,6 +294,4 @@ class PhraseExactLessThanWithToken }; -using namespace pinyin; - #endif diff --git a/src/storage/tag_utility.cpp b/src/storage/tag_utility.cpp index 69b163b..a0179f3 100644 --- a/src/storage/tag_utility.cpp +++ b/src/storage/tag_utility.cpp @@ -7,6 +7,8 @@ #include "phrase_large_table.h" #include "tag_utility.h" +using namespace pinyin; + /* internal taglib structure */ struct tag_entry{ int m_line_type; diff --git a/src/storage/tag_utility.h b/src/storage/tag_utility.h index 67d8946..d52b2c4 100644 --- a/src/storage/tag_utility.h +++ b/src/storage/tag_utility.h @@ -54,7 +54,8 @@ bool taglib_pop_state(); bool taglib_fini(); namespace pinyin{ - class PhraseLargeTable; +class PhraseLargeTable; +class FacadePhraseIndex; }; using namespace pinyin; |