refine namespace pinyin
authorPeng Wu <alexepico@gmail.com>
Mon, 8 Aug 2011 07:24:51 +0000 (15:24 +0800)
committerPeng Wu <alexepico@gmail.com>
Mon, 8 Aug 2011 07:24:51 +0000 (15:24 +0800)
19 files changed:
src/lookup/lookup.h
src/lookup/phrase_lookup.cpp
src/lookup/phrase_lookup.h
src/lookup/pinyin_lookup.cpp
src/lookup/pinyin_lookup.h
src/lookup/winner_tree.cpp
src/lookup/winner_tree.h
src/pinyin.h
src/storage/ngram.cpp
src/storage/ngram.h
src/storage/phrase_index.cpp
src/storage/phrase_index.h
src/storage/phrase_large_table.h
src/storage/pinyin_base.cpp
src/storage/pinyin_base.h
src/storage/pinyin_large_table.h
src/storage/pinyin_phrase.h
src/storage/tag_utility.cpp
src/storage/tag_utility.h

index fc98f95..8076d54 100644 (file)
@@ -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
index c51fabc..c176773 100644 (file)
@@ -27,6 +27,8 @@
 #include "ngram.h"
 #include "phrase_lookup.h"
 
+using namespace pinyin;
+
 const gfloat PhraseLookup::bigram_lambda;
 const gfloat PhraseLookup::unigram_lambda;
 
index 61c5487..495e44e 100644 (file)
@@ -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
index 8264127..10d61b4 100644 (file)
@@ -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;
 
index 980b23d..b8f2e58 100644 (file)
@@ -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
index da87951..29135f5 100644 (file)
@@ -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()];
index 0d9bfa2..0559589 100644 (file)
@@ -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
index a360a3c..88f1fb5 100644 (file)
@@ -15,4 +15,6 @@
 /* training module */
 #include "flexible_ngram.h"
 
+using namespace pinyin;
+
 typedef struct _pinyin_context_t pinyin_context_t;
index 35aea0c..a4d72c2 100644 (file)
@@ -26,6 +26,8 @@
 #include "novel_types.h"
 #include "ngram.h"
 
+using namespace pinyin;
+
 struct SingleGramItem{
     phrase_token_t m_token;
     guint32 m_freq;
index f8b59f1..1f891d0 100644 (file)
@@ -132,7 +132,4 @@ public:
 
 };
 
-using namespace pinyin;
-
-
 #endif
index 364601e..33da334 100644 (file)
@@ -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;
index d7fd4bc..ccabc9b 100644 (file)
  * ++++++++++++++++++++++++++++++++++++++++++
  */
 
-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
index 423c457..6e14d2e 100644 (file)
@@ -106,6 +106,4 @@ public:
 
 };
 
-using namespace pinyin;
-
 #endif
index e7715a0..7e2f805 100644 (file)
@@ -25,6 +25,8 @@
 #include "pinyin_phrase.h"
 #include "pinyin_large_table.h"
 
+using namespace pinyin;
+
 // Internal data definition
 
 /**
index 14d3a99..56b260f 100644 (file)
@@ -723,6 +723,4 @@ int pinyin_compare_tone (const PinyinCustomSettings &custom,
                         PinyinTone rhs);
 };
 
-using namespace pinyin;
-
 #endif
index 83f4de9..2ef862d 100644 (file)
@@ -134,5 +134,4 @@ public:
 
 };
 
-using namespace pinyin;
 #endif
index cbcb742..df6f26a 100644 (file)
@@ -294,6 +294,4 @@ class PhraseExactLessThanWithToken
 
 };
 
-using namespace pinyin;
-
 #endif
index 69b163b..a0179f3 100644 (file)
@@ -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;
index 67d8946..d52b2c4 100644 (file)
@@ -54,7 +54,8 @@ bool taglib_pop_state();
 bool taglib_fini();
 
 namespace pinyin{
-    class PhraseLargeTable;
+class PhraseLargeTable;
+class FacadePhraseIndex;
 };
 
 using namespace pinyin;