Put classes under dictionary into mozc::dictionary namespace.

This is just a code cleanup.  Hence no behavior change should occur.

BUG=none
TEST=unittest
diff --git a/src/chrome/nacl/nacl_session_handler.cc b/src/chrome/nacl/nacl_session_handler.cc
index 887177c..997f267 100644
--- a/src/chrome/nacl/nacl_session_handler.cc
+++ b/src/chrome/nacl/nacl_session_handler.cc
@@ -193,9 +193,8 @@
     PepperFileUtil::Initialize(instance_, kFileIoFileSystemExpectedSize);
     LoadDictionary();
 #endif  // GOOGLE_JAPANESE_INPUT_BUILD
-    user_pos_.reset(
-        new UserPOS(
-            packed::PackedDataManager::GetUserPosManager()->GetUserPOSData()));
+    user_pos_.reset(new dictionary::UserPOS(
+        packed::PackedDataManager::GetUserPosManager()->GetUserPOSData()));
 
     engine_.reset(mozc::EngineFactory::Create());
     handler_.reset(new SessionHandler(engine_.get()));
diff --git a/src/converter/candidate_filter.cc b/src/converter/candidate_filter.cc
index cd70f12..5a6aa92 100644
--- a/src/converter/candidate_filter.cc
+++ b/src/converter/candidate_filter.cc
@@ -46,6 +46,7 @@
 #include "dictionary/suppression_dictionary.h"
 #include "prediction/suggestion_filter.h"
 
+using mozc::dictionary::POSMatcher;
 using mozc::dictionary::SuppressionDictionary;
 
 namespace mozc {
diff --git a/src/converter/candidate_filter.h b/src/converter/candidate_filter.h
index 819307a..4ac6203 100644
--- a/src/converter/candidate_filter.h
+++ b/src/converter/candidate_filter.h
@@ -36,12 +36,12 @@
 
 #include "base/port.h"
 #include "converter/segments.h"
+#include "dictionary/pos_matcher.h"
 #include "dictionary/suppression_dictionary.h"
 
 namespace mozc {
 
 struct Node;
-class POSMatcher;
 class SuggestionFilter;
 
 namespace converter {
@@ -50,7 +50,7 @@
  public:
   CandidateFilter(
       const dictionary::SuppressionDictionary *suppression_dictionary,
-      const POSMatcher *pos_matcher,
+      const dictionary::POSMatcher *pos_matcher,
       const SuggestionFilter *suggestion_filter);
   ~CandidateFilter();
 
@@ -76,7 +76,7 @@
                                      Segments::RequestType request_type);
 
   const dictionary::SuppressionDictionary *suppression_dictionary_;
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
   const SuggestionFilter *suggestion_filter_;
 
   set<string> seen_;
diff --git a/src/converter/candidate_filter_test.cc b/src/converter/candidate_filter_test.cc
index 5334a74..b83c88e 100644
--- a/src/converter/candidate_filter_test.cc
+++ b/src/converter/candidate_filter_test.cc
@@ -47,6 +47,7 @@
 #include "prediction/suggestion_filter.h"
 #include "testing/base/public/gunit.h"
 
+using mozc::dictionary::POSMatcher;
 using mozc::dictionary::SuppressionDictionary;
 
 namespace mozc {
diff --git a/src/converter/converter.cc b/src/converter/converter.cc
index 9995fc5..c689760 100644
--- a/src/converter/converter.cc
+++ b/src/converter/converter.cc
@@ -50,6 +50,7 @@
 #include "transliteration/transliteration.h"
 #include "usage_stats/usage_stats.h"
 
+using mozc::dictionary::POSMatcher;
 using mozc::dictionary::SuppressionDictionary;
 using mozc::usage_stats::UsageStats;
 
diff --git a/src/converter/converter.h b/src/converter/converter.h
index b2b9801..54ca09c 100644
--- a/src/converter/converter.h
+++ b/src/converter/converter.h
@@ -34,6 +34,7 @@
 
 #include "base/scoped_ptr.h"
 #include "converter/converter_interface.h"
+#include "dictionary/pos_matcher.h"
 #include "dictionary/suppression_dictionary.h"
 //  for FRIEND_TEST()
 #include "testing/base/public/gunit_prod.h"
@@ -42,7 +43,6 @@
 
 class ConversionRequest;
 class ImmutableConverterInterface;
-class POSMatcher;
 class PredictorInterface;
 class RewriterInterface;
 class Segments;
@@ -53,7 +53,7 @@
   virtual ~ConverterImpl();
 
   // Lazily initializes the internal members. Must be called before the use.
-  void Init(const POSMatcher *pos_matcher,
+  void Init(const dictionary::POSMatcher *pos_matcher,
             const dictionary::SuppressionDictionary *suppression_dictionary,
             PredictorInterface *predictor,
             RewriterInterface *rewriter,
@@ -168,7 +168,7 @@
                              string *value,
                              uint16 *id) const;
 
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
   const dictionary::SuppressionDictionary *suppression_dictionary_;
   scoped_ptr<PredictorInterface> predictor_;
   scoped_ptr<RewriterInterface> rewriter_;
diff --git a/src/converter/converter_test.cc b/src/converter/converter_test.cc
index b9feb80..ed2007a 100644
--- a/src/converter/converter_test.cc
+++ b/src/converter/converter_test.cc
@@ -81,11 +81,15 @@
 DECLARE_string(test_tmpdir);
 
 using mozc::dictionary::DictionaryImpl;
+using mozc::dictionary::DictionaryInterface;
 using mozc::dictionary::DictionaryMock;
+using mozc::dictionary::PosGroup;
 using mozc::dictionary::SuffixDictionary;
 using mozc::dictionary::SuffixToken;
 using mozc::dictionary::SuppressionDictionary;
 using mozc::dictionary::SystemDictionary;
+using mozc::dictionary::Token;
+using mozc::dictionary::UserDictionaryStub;
 using mozc::dictionary::ValueDictionary;
 using mozc::usage_stats::UsageStats;
 
diff --git a/src/converter/immutable_converter.cc b/src/converter/immutable_converter.cc
index 1e2447b..0a7e185 100644
--- a/src/converter/immutable_converter.cc
+++ b/src/converter/immutable_converter.cc
@@ -61,7 +61,11 @@
 #include "prediction/suggestion_filter.h"
 #include "session/commands.pb.h"
 
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::PosGroup;
 using mozc::dictionary::SuppressionDictionary;
+using mozc::dictionary::Token;
 
 namespace mozc {
 namespace {
diff --git a/src/converter/immutable_converter.h b/src/converter/immutable_converter.h
index f98a6a7..61545d1 100644
--- a/src/converter/immutable_converter.h
+++ b/src/converter/immutable_converter.h
@@ -38,6 +38,9 @@
 #include "converter/immutable_converter_interface.h"
 #include "converter/node.h"
 #include "converter/segments.h"
+#include "dictionary/dictionary_interface.h"
+#include "dictionary/pos_group.h"
+#include "dictionary/pos_matcher.h"
 #include "dictionary/suppression_dictionary.h"
 //  for FRIEND_TEST()
 #include "testing/base/public/gunit_prod.h"
@@ -45,25 +48,22 @@
 namespace mozc {
 
 struct Node;
-class DictionaryInterface;
 class ImmutableConverterInterface;
 class Lattice;
 class NBestGenerator;
-class POSMatcher;
-class PosGroup;
 class Segmenter;
 class SuggestionFilter;
 
 class ImmutableConverterImpl : public ImmutableConverterInterface {
  public:
   ImmutableConverterImpl(
-      const DictionaryInterface *dictionary,
-      const DictionaryInterface *suffix_dictionary,
+      const dictionary::DictionaryInterface *dictionary,
+      const dictionary::DictionaryInterface *suffix_dictionary,
       const dictionary::SuppressionDictionary *suppression_dictionary,
       const Connector *connector,
       const Segmenter *segmenter,
-      const POSMatcher *pos_matcher,
-      const PosGroup *pos_group,
+      const dictionary::POSMatcher *pos_matcher,
+      const dictionary::PosGroup *pos_group,
       const SuggestionFilter *suggestion_filter);
   virtual ~ImmutableConverterImpl() {}
 
@@ -180,13 +180,13 @@
     return connector_->GetTransitionCost(lnode->rid, rnode->lid) + rnode->wcost;
   }
 
-  const DictionaryInterface *dictionary_;
-  const DictionaryInterface *suffix_dictionary_;
+  const dictionary::DictionaryInterface *dictionary_;
+  const dictionary::DictionaryInterface *suffix_dictionary_;
   const dictionary::SuppressionDictionary *suppression_dictionary_;
   const Connector *connector_;
   const Segmenter *segmenter_;
-  const POSMatcher *pos_matcher_;
-  const PosGroup *pos_group_;
+  const dictionary::POSMatcher *pos_matcher_;
+  const dictionary::PosGroup *pos_group_;
   const SuggestionFilter *suggestion_filter_;
 
   // Cache for POS ids.
diff --git a/src/converter/immutable_converter_test.cc b/src/converter/immutable_converter_test.cc
index 4e402f0..5b16c27 100644
--- a/src/converter/immutable_converter_test.cc
+++ b/src/converter/immutable_converter_test.cc
@@ -64,10 +64,14 @@
 DECLARE_string(test_tmpdir);
 
 using mozc::dictionary::DictionaryImpl;
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::PosGroup;
 using mozc::dictionary::SuffixDictionary;
 using mozc::dictionary::SuffixToken;
 using mozc::dictionary::SuppressionDictionary;
 using mozc::dictionary::SystemDictionary;
+using mozc::dictionary::UserDictionaryStub;
 using mozc::dictionary::ValueDictionary;
 
 namespace mozc {
diff --git a/src/converter/nbest_generator.cc b/src/converter/nbest_generator.cc
index 124019c..64b4242 100644
--- a/src/converter/nbest_generator.cc
+++ b/src/converter/nbest_generator.cc
@@ -43,6 +43,7 @@
 #include "converter/segments.h"
 #include "dictionary/pos_matcher.h"
 
+using mozc::dictionary::POSMatcher;
 using mozc::dictionary::SuppressionDictionary;
 
 namespace mozc {
diff --git a/src/converter/nbest_generator.h b/src/converter/nbest_generator.h
index fc7cd26..25419ce 100644
--- a/src/converter/nbest_generator.h
+++ b/src/converter/nbest_generator.h
@@ -39,12 +39,12 @@
 #include "converter/candidate_filter.h"
 #include "converter/segments.h"
 #include "dictionary/suppression_dictionary.h"
+#include "dictionary/pos_matcher.h"
 
 namespace mozc {
 
 class Connector;
 class Lattice;
-class POSMatcher;
 class Segmenter;
 class SuggestionFilter;
 struct Node;
@@ -84,7 +84,7 @@
       const dictionary::SuppressionDictionary *suppression_dictionary,
       const Segmenter *segmenter,
       const Connector *connector,
-      const POSMatcher *pos_matcher,
+      const dictionary::POSMatcher *pos_matcher,
       const Lattice *lattice,
       const SuggestionFilter *suggestion_filter);
   ~NBestGenerator();
@@ -173,7 +173,7 @@
   const dictionary::SuppressionDictionary *suppression_dictionary_;
   const Segmenter *segmenter_;
   const Connector *connector_;
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
   const Lattice *lattice_;
 
   const Node *begin_node_;
diff --git a/src/converter/nbest_generator_test.cc b/src/converter/nbest_generator_test.cc
index beb2605..737f86d 100644
--- a/src/converter/nbest_generator_test.cc
+++ b/src/converter/nbest_generator_test.cc
@@ -59,10 +59,14 @@
 DECLARE_string(test_tmpdir);
 
 using mozc::dictionary::DictionaryImpl;
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::PosGroup;
 using mozc::dictionary::SuffixDictionary;
 using mozc::dictionary::SuffixToken;
 using mozc::dictionary::SuppressionDictionary;
 using mozc::dictionary::SystemDictionary;
+using mozc::dictionary::UserDictionaryStub;
 using mozc::dictionary::ValueDictionary;
 
 namespace mozc {
diff --git a/src/converter/node.h b/src/converter/node.h
index b5640f5..db82462 100644
--- a/src/converter/node.h
+++ b/src/converter/node.h
@@ -86,7 +86,7 @@
   // begin_nodes: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | ... | N | (in lattice)
   //                |   |   :   :   :   :   :         :
   //                |   :
-  //                |   :          (NULL)
+  //                |   :          (nullptr)
   //                |   :           ^
   //                |   :           :
   //                v   :           |
@@ -96,14 +96,14 @@
   //           bnext|   :           ^
   //                v   :           |enext
   //               +-----------------+
-  //               | Node2(len4)     | (NULL)
+  //               | Node2(len4)     | (nullptr)
   //               +-----------------+  ^
   //           bnext|   :           ^   :
   //                |   :           |   :
   //                v   :           :   |enext
   //               +---------------------+
   //               | Node3(len5)         |
-  //               +---------------------+ (NULL)
+  //               +---------------------+ (nullptr)
   //           bnext|   :           :   ^   ^
   //                |   :           :   |   :
   //                v   :           :   :   |enext
@@ -113,7 +113,7 @@
   //           bnext|   :           :   :   ^
   //                :   :           :   :   |
   //                v   :           :   :   :
-  //             (NULL) |           :   :   :
+  //          (nullptr) |           :   :   :
   //                    v           :   |enext
   //                   +-----------------+  :
   //                   | Node5(len4)     |  :
@@ -137,7 +137,7 @@
   //               bnext|           :   :   ^
   //                    :           :   :   |
   //                    v           :   :   |
-  //                  (NULL)        :   :   |
+  //               (nullptr)        :   :   |
   //                                :   :   |
   //                :   :   :   :   :   |   |         :
   // end_nodes:   | 0 | 1 | 2 | 3 | 4 | 5 | 6 | ... | N |  (in lattice)
@@ -150,7 +150,7 @@
   Node *bnext;
   Node *enext;
 
-  // if it is not NULL, transition cost
+  // if it is not nullptr, transition cost
   // from constrained_prev to current node is defined,
   // other transition is set to be infinite
   Node *constrained_prev;
@@ -187,11 +187,11 @@
   }
 
   inline void Init() {
-    prev = NULL;
-    next = NULL;
-    bnext = NULL;
-    enext = NULL;
-    constrained_prev = NULL;
+    prev = nullptr;
+    next = nullptr;
+    bnext = nullptr;
+    enext = nullptr;
+    constrained_prev = nullptr;
     rid = 0;
     lid = 0;
     begin_pos = 0;
@@ -206,12 +206,12 @@
     value.clear();
   }
 
-  inline void InitFromToken(const Token &token) {
-    prev = NULL;
-    next = NULL;
-    bnext = NULL;
-    enext = NULL;
-    constrained_prev = NULL;
+  inline void InitFromToken(const dictionary::Token &token) {
+    prev = nullptr;
+    next = nullptr;
+    bnext = nullptr;
+    enext = nullptr;
+    constrained_prev = nullptr;
     rid = token.rid;
     lid = token.lid;
     begin_pos = 0;
@@ -221,10 +221,10 @@
     cost = 0;
     raw_wcost = 0;
     attributes = 0;
-    if (token.attributes & Token::SPELLING_CORRECTION) {
+    if (token.attributes & dictionary::Token::SPELLING_CORRECTION) {
       attributes |= SPELLING_CORRECTION;
     }
-    if (token.attributes & Token::USER_DICTIONARY) {
+    if (token.attributes & dictionary::Token::USER_DICTIONARY) {
       attributes |= USER_DICTIONARY;
       attributes |= NO_VARIANTS_EXPANSION;
     }
diff --git a/src/converter/node_list_builder.h b/src/converter/node_list_builder.h
index 601adb9..df9d551 100644
--- a/src/converter/node_list_builder.h
+++ b/src/converter/node_list_builder.h
@@ -45,7 +45,7 @@
 // Provides basic functionality for building a list of nodes.
 // This class is defined inline because it contributes to the performance of
 // dictionary lookup.
-class BaseNodeListBuilder : public DictionaryInterface::Callback {
+class BaseNodeListBuilder : public dictionary::DictionaryInterface::Callback {
  public:
   BaseNodeListBuilder(NodeAllocator *allocator, int limit)
       : allocator_(allocator), limit_(limit), penalty_(0), result_(NULL) {
@@ -62,7 +62,7 @@
 
   // Creates a new node and prepends it to the current list.
   virtual ResultType OnToken(StringPiece key, StringPiece actual_key,
-                             const Token &token) {
+                             const dictionary::Token &token) {
     Node *new_node = NewNodeFromToken(token);
     PrependNode(new_node);
     return (limit_ <= 0) ? TRAVERSE_DONE : TRAVERSE_CONTINUE;
@@ -73,7 +73,7 @@
   Node *result() const { return result_; }
   NodeAllocator *allocator() { return allocator_; }
 
-  Node *NewNodeFromToken(const Token &token) {
+  Node *NewNodeFromToken(const dictionary::Token &token) {
     Node *new_node = allocator_->NewNode();
     new_node->InitFromToken(token);
     new_node->wcost += penalty_;
diff --git a/src/data_manager/chromeos/chromeos_user_pos_manager.cc b/src/data_manager/chromeos/chromeos_user_pos_manager.cc
index 2e7ccc2..71c1b06 100644
--- a/src/data_manager/chromeos/chromeos_user_pos_manager.cc
+++ b/src/data_manager/chromeos/chromeos_user_pos_manager.cc
@@ -50,7 +50,8 @@
 
 }  // namespace
 
-const UserPOS::POSToken *ChromeOsUserPosManager::GetUserPOSData() const {
+const dictionary::UserPOS::POSToken *
+ChromeOsUserPosManager::GetUserPOSData() const {
   DCHECK(kPOSToken != NULL);
   return kPOSToken;
 }
@@ -60,13 +61,13 @@
 // kRuleIdTable[] and kRangeTable[].
 #include "data_manager/chromeos/pos_matcher_data.h"
 
-class ChromeOsPOSMatcher : public POSMatcher {
+class ChromeOsPOSMatcher : public dictionary::POSMatcher {
  public:
   ChromeOsPOSMatcher() : POSMatcher(kRuleIdTable, kRangeTables) {}
 };
 }  // namespace
 
-const POSMatcher *ChromeOsUserPosManager::GetPOSMatcher() const {
+const dictionary::POSMatcher *ChromeOsUserPosManager::GetPOSMatcher() const {
   return Singleton<ChromeOsPOSMatcher>::get();
 }
 
diff --git a/src/data_manager/chromeos/chromeos_user_pos_manager.h b/src/data_manager/chromeos/chromeos_user_pos_manager.h
index 880bffc..361374d 100644
--- a/src/data_manager/chromeos/chromeos_user_pos_manager.h
+++ b/src/data_manager/chromeos/chromeos_user_pos_manager.h
@@ -34,9 +34,6 @@
 #include "data_manager/data_manager_interface.h"
 
 namespace mozc {
-
-class POSMatcher;
-
 namespace chromeos {
 
 class ChromeOsUserPosManager : public DataManagerInterface {
@@ -48,8 +45,8 @@
 
   // Partially implement the interface because some binary only reqiures the
   // folloiwng embedded data.
-  virtual const UserPOS::POSToken *GetUserPOSData() const;
-  virtual const POSMatcher *GetPOSMatcher() const;
+  virtual const dictionary::UserPOS::POSToken *GetUserPOSData() const;
+  virtual const dictionary::POSMatcher *GetPOSMatcher() const;
 
   // The following are implemented in ChromeOsDataManager.
   virtual const uint8 *GetPosGroupData() const { return NULL; }
diff --git a/src/data_manager/data_manager_interface.h b/src/data_manager/data_manager_interface.h
index 31a62fa..56e0a06 100644
--- a/src/data_manager/data_manager_interface.h
+++ b/src/data_manager/data_manager_interface.h
@@ -36,7 +36,6 @@
 
 namespace mozc {
 
-class POSMatcher;
 struct BoundaryData;
 struct CounterSuffixEntry;
 struct ReadingCorrectionItem;
@@ -45,7 +44,10 @@
 struct UsageDictItem;
 #endif  // NO_USAGE_REWRITER
 
-namespace dictionary { struct SuffixToken; }
+namespace dictionary {
+class POSMatcher;
+struct SuffixToken;
+}  // namespace dictionary
 
 // Builds those objects that depend on a set of embedded data generated from
 // files in data/dictionary, such as dictionary.txt, id.def, etc.
@@ -54,11 +56,11 @@
   virtual ~DataManagerInterface() {}
 
   // Returns the address of an array of UserPOS::POSToken.
-  virtual const UserPOS::POSToken *GetUserPOSData() const = 0;
+  virtual const dictionary::UserPOS::POSToken *GetUserPOSData() const = 0;
 
   // Returns a reference to POSMatcher class handling POS rules. Don't
   // delete the returned pointer, which is owned by the manager.
-  virtual const POSMatcher *GetPOSMatcher() const = 0;
+  virtual const dictionary::POSMatcher *GetPOSMatcher() const = 0;
 
   // Returns the address of an array of lid group.
   virtual const uint8 *GetPosGroupData() const = 0;
diff --git a/src/data_manager/data_manager_test_base.cc b/src/data_manager/data_manager_test_base.cc
index 90599bf..9a16196 100644
--- a/src/data_manager/data_manager_test_base.cc
+++ b/src/data_manager/data_manager_test_base.cc
@@ -50,6 +50,8 @@
 
 DECLARE_string(test_srcdir);
 
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 namespace {
 
diff --git a/src/data_manager/oss/oss_user_pos_manager.cc b/src/data_manager/oss/oss_user_pos_manager.cc
index 5971217..80db4c2 100644
--- a/src/data_manager/oss/oss_user_pos_manager.cc
+++ b/src/data_manager/oss/oss_user_pos_manager.cc
@@ -50,7 +50,7 @@
 
 }  // namespace
 
-const UserPOS::POSToken *OssUserPosManager::GetUserPOSData() const {
+const dictionary::UserPOS::POSToken *OssUserPosManager::GetUserPOSData() const {
   DCHECK(kPOSToken != NULL);
   return kPOSToken;
 }
@@ -60,13 +60,13 @@
 // kRuleIdTable[] and kRangeTable[].
 #include "data_manager/oss/pos_matcher_data.h"
 
-class OssPOSMatcher : public POSMatcher {
+class OssPOSMatcher : public dictionary::POSMatcher {
  public:
   OssPOSMatcher() : POSMatcher(kRuleIdTable, kRangeTables) {}
 };
 }  // namespace
 
-const POSMatcher *OssUserPosManager::GetPOSMatcher() const {
+const dictionary::POSMatcher *OssUserPosManager::GetPOSMatcher() const {
   return Singleton<OssPOSMatcher>::get();
 }
 
diff --git a/src/data_manager/oss/oss_user_pos_manager.h b/src/data_manager/oss/oss_user_pos_manager.h
index d4f8e19..832cae9 100644
--- a/src/data_manager/oss/oss_user_pos_manager.h
+++ b/src/data_manager/oss/oss_user_pos_manager.h
@@ -34,9 +34,6 @@
 #include "data_manager/data_manager_interface.h"
 
 namespace mozc {
-
-class POSMatcher;
-
 namespace oss {
 
 class OssUserPosManager : public DataManagerInterface {
@@ -49,8 +46,8 @@
   // Partially implement the interface because some binary only reqiures the
   // folloiwng embedded data.
   // Returns the address to an array of UserPOS::POSToken.
-  virtual const UserPOS::POSToken *GetUserPOSData() const;
-  virtual const POSMatcher *GetPOSMatcher() const;
+  virtual const dictionary::UserPOS::POSToken *GetUserPOSData() const;
+  virtual const dictionary::POSMatcher *GetPOSMatcher() const;
 
   // The following are implemented in OssDataManager.
   virtual const uint8 *GetPosGroupData() const { return NULL; }
diff --git a/src/data_manager/packed/packed_data_manager.cc b/src/data_manager/packed/packed_data_manager.cc
index 7bd73e3..757a5b6 100644
--- a/src/data_manager/packed/packed_data_manager.cc
+++ b/src/data_manager/packed/packed_data_manager.cc
@@ -54,7 +54,10 @@
               "The dataset tag of the POS data.");
 
 using std::unique_ptr;
+
+using mozc::dictionary::POSMatcher;
 using mozc::dictionary::SuffixToken;
+using mozc::dictionary::UserPOS;
 
 namespace mozc {
 namespace packed {
diff --git a/src/data_manager/packed/packed_data_manager.h b/src/data_manager/packed/packed_data_manager.h
index 5026fcc..eb588c5 100644
--- a/src/data_manager/packed/packed_data_manager.h
+++ b/src/data_manager/packed/packed_data_manager.h
@@ -49,8 +49,8 @@
 
   static PackedDataManager *GetUserPosManager();
 
-  virtual const UserPOS::POSToken *GetUserPOSData() const;
-  virtual const POSMatcher *GetPOSMatcher() const;
+  virtual const dictionary::UserPOS::POSToken *GetUserPOSData() const;
+  virtual const dictionary::POSMatcher *GetPOSMatcher() const;
   virtual const uint8 *GetPosGroupData() const;
   virtual void GetConnectorData(const char **data, size_t *size) const;
   virtual void GetSegmenterData(
diff --git a/src/data_manager/packed/system_dictionary_data_packer.cc b/src/data_manager/packed/system_dictionary_data_packer.cc
index 1c5345f..f29a779 100644
--- a/src/data_manager/packed/system_dictionary_data_packer.cc
+++ b/src/data_manager/packed/system_dictionary_data_packer.cc
@@ -51,7 +51,9 @@
 #include "rewriter/usage_rewriter_data_structs.h"
 #endif  // NO_USAGE_REWRITER
 
+using mozc::dictionary::POSMatcher;
 using mozc::dictionary::SuffixToken;
+using mozc::dictionary::UserPOS;
 
 namespace mozc {
 namespace packed {
diff --git a/src/data_manager/packed/system_dictionary_data_packer.h b/src/data_manager/packed/system_dictionary_data_packer.h
index 6e2a9c2..b15ddbd 100644
--- a/src/data_manager/packed/system_dictionary_data_packer.h
+++ b/src/data_manager/packed/system_dictionary_data_packer.h
@@ -56,12 +56,12 @@
   explicit SystemDictionaryDataPacker(const string &product_version);
   ~SystemDictionaryDataPacker();
   void SetPosTokens(
-      const UserPOS::POSToken *pos_token_data,
+      const dictionary::UserPOS::POSToken *pos_token_data,
       size_t token_count);
   void SetPosMatcherData(
       const uint16 *rule_id_table,
       size_t rule_id_table_count,
-      const POSMatcher::Range *const *range_tables,
+      const dictionary::POSMatcher::Range *const *range_tables,
       size_t range_tables_count);
   void SetLidGroupData(
       const void *lid_group_data,
diff --git a/src/data_manager/testing/mock_user_pos_manager.cc b/src/data_manager/testing/mock_user_pos_manager.cc
index ea4e3f4..2b408db 100644
--- a/src/data_manager/testing/mock_user_pos_manager.cc
+++ b/src/data_manager/testing/mock_user_pos_manager.cc
@@ -50,7 +50,8 @@
 
 }  // namespace
 
-const UserPOS::POSToken *MockUserPosManager::GetUserPOSData() const {
+const dictionary::UserPOS::POSToken *
+MockUserPosManager::GetUserPOSData() const {
   DCHECK(kPOSToken != NULL);
   return kPOSToken;
 }
@@ -60,13 +61,13 @@
 // kRuleIdTable[] and kRangeTable[].
 #include "data_manager/testing/pos_matcher_data.h"
 
-class MockPOSMatcher : public POSMatcher {
+class MockPOSMatcher : public dictionary::POSMatcher {
  public:
   MockPOSMatcher() : POSMatcher(kRuleIdTable, kRangeTables) {}
 };
 }  // namespace
 
-const POSMatcher *MockUserPosManager::GetPOSMatcher() const {
+const dictionary::POSMatcher *MockUserPosManager::GetPOSMatcher() const {
   return Singleton<MockPOSMatcher>::get();
 }
 
diff --git a/src/data_manager/testing/mock_user_pos_manager.h b/src/data_manager/testing/mock_user_pos_manager.h
index 136b18c..639035d 100644
--- a/src/data_manager/testing/mock_user_pos_manager.h
+++ b/src/data_manager/testing/mock_user_pos_manager.h
@@ -34,9 +34,6 @@
 #include "data_manager/data_manager_interface.h"
 
 namespace mozc {
-
-class POSMatcher;
-
 namespace testing {
 
 class MockUserPosManager : public DataManagerInterface {
@@ -48,8 +45,8 @@
 
   // Partially implement the interface because some binary only reqiures the
   // folloiwng embedded data.
-  virtual const UserPOS::POSToken *GetUserPOSData() const;
-  virtual const POSMatcher *GetPOSMatcher() const;
+  virtual const dictionary::UserPOS::POSToken *GetUserPOSData() const;
+  virtual const dictionary::POSMatcher *GetPOSMatcher() const;
 
   // The following are implemented in MockDataManager.
   virtual const uint8 *GetPosGroupData() const { return NULL; }
diff --git a/src/dictionary/dictionary_interface.h b/src/dictionary/dictionary_interface.h
index acf8163..ef10827 100644
--- a/src/dictionary/dictionary_interface.h
+++ b/src/dictionary/dictionary_interface.h
@@ -39,8 +39,8 @@
 #include "dictionary/dictionary_token.h"
 
 namespace mozc {
+namespace dictionary {
 
-// TODO(noriyukit): Move this interface into dictionary namespace.
 class DictionaryInterface {
  public:
   // Callback interface for dictionary traversal (currently implemented only for
@@ -153,6 +153,7 @@
   DictionaryInterface() {}
 };
 
+}  // namespace dictionary
 }  // namespace mozc
 
 #endif  // MOZC_DICTIONARY_DICTIONARY_INTERFACE_H_
diff --git a/src/dictionary/dictionary_token.h b/src/dictionary/dictionary_token.h
index 76a3feb..14fd5d0 100644
--- a/src/dictionary/dictionary_token.h
+++ b/src/dictionary/dictionary_token.h
@@ -35,6 +35,7 @@
 #include "base/port.h"
 
 namespace mozc {
+namespace dictionary {
 
 struct Token {
   typedef uint8 AttributesBitfield;
@@ -63,6 +64,7 @@
   AttributesBitfield attributes;
 };
 
+}  // namespace dictionary
 }  // namespace mozc
 
 #endif  // MOZC_DICTIONARY_DICTIONARY_TOKEN_H_
diff --git a/src/dictionary/gen_pos_matcher_code.py b/src/dictionary/gen_pos_matcher_code.py
index 2bc927e..e6e0852 100644
--- a/src/dictionary/gen_pos_matcher_code.py
+++ b/src/dictionary/gen_pos_matcher_code.py
@@ -78,7 +78,8 @@
   for rule_name in pos_matcher.GetRuleNameList():
     output.write(
         '// %(rule_name)s "%(original_pattern)s"\n'
-        'const ::mozc::POSMatcher::Range kRangeTable_%(rule_name)s[] = {\n'
+        'const ::mozc::dictionary::POSMatcher::Range '
+        'kRangeTable_%(rule_name)s[] = {\n'
         % { 'rule_name': rule_name,
             'original_pattern': pos_matcher.GetOriginalPattern(rule_name) })
     for id_range in pos_matcher.GetRange(rule_name):
@@ -91,7 +92,8 @@
 
   # Generate kRangeTable[].
   output.write(
-      'const ::mozc::POSMatcher::Range *const kRangeTables[%d] = {\n'
+      'const ::mozc::dictionary::POSMatcher::Range *const '
+      'kRangeTables[%d] = {\n'
       % (len(pos_matcher.GetRuleNameList()) + 1))
   for rule_name in pos_matcher.GetRuleNameList():
     output.write('  kRangeTable_%s,\n' % rule_name)
@@ -112,6 +114,7 @@
       '#define MOZC_DICTIONARY_POS_MATCHER_H_\n'
       '#include "./base/port.h"\n'
       'namespace mozc {\n'
+      'namespace dictionary {\n'
       'class POSMatcher {\n'
       ' public:\n'
       '  struct Range {\n'
@@ -163,6 +166,7 @@
       '  const uint16 *const rule_id_table_;\n'
       '  const Range *const *const range_table_;\n'
       '};\n'
+      '}  // namespace dictionary\n'
       '}  // namespace mozc\n'
       '#endif  // MOZC_DICTIONARY_POS_MATCHER_H_\n')
 
diff --git a/src/dictionary/gen_system_dictionary_data_main.cc b/src/dictionary/gen_system_dictionary_data_main.cc
index 454f91d..d21418a 100644
--- a/src/dictionary/gen_system_dictionary_data_main.cc
+++ b/src/dictionary/gen_system_dictionary_data_main.cc
@@ -99,13 +99,13 @@
                          &system_dictionary_input,
                          &reading_correction_input);
 
-  const mozc::POSMatcher *pos_matcher =
+  const mozc::dictionary::POSMatcher *pos_matcher =
       FLAGS_gen_test_dictionary ?
       mozc::testing::MockUserPosManager::GetUserPosManager()->GetPOSMatcher() :
       mozc::UserPosManager::GetUserPosManager()->GetPOSMatcher();
   CHECK(pos_matcher);
 
-  mozc::TextDictionaryLoader loader(*pos_matcher);
+  mozc::dictionary::TextDictionaryLoader loader(*pos_matcher);
   loader.Load(system_dictionary_input, reading_correction_input);
 
   mozc::dictionary::SystemDictionaryBuilder builder;
diff --git a/src/dictionary/gen_user_pos_data.py b/src/dictionary/gen_user_pos_data.py
index 1f1ba63..53a756e 100644
--- a/src/dictionary/gen_user_pos_data.py
+++ b/src/dictionary/gen_user_pos_data.py
@@ -45,8 +45,8 @@
   # Output kConjugation
   for index, (_, conjugation_list) in enumerate(user_pos_data):
     output.write(
-        'static const UserPOS::ConjugationType kConjugation%d[] = {\n' % (
-            index))
+        'static const ::mozc::dictionary::UserPOS::ConjugationType '
+        'kConjugation%d[] = {\n' % (index))
     for value_suffix, key_suffix, pos_id in conjugation_list:
       output.write('  { %s, %s, %d },\n' % (
           code_generator_util.ToCppStringLiteral(value_suffix),
@@ -55,7 +55,7 @@
     output.write('};\n')
 
   # Output PosToken
-  output.write('const UserPOS::POSToken kPOSToken[] = {\n')
+  output.write('const ::mozc::dictionary::UserPOS::POSToken kPOSToken[] = {\n')
   for index, (user_pos, conjunction_list) in enumerate(user_pos_data):
     output.write('  { %s, %d, kConjugation%d },\n' % (
         code_generator_util.ToCppStringLiteral(user_pos),
diff --git a/src/dictionary/pos_group.h b/src/dictionary/pos_group.h
index 52d6bfa..12dc650 100644
--- a/src/dictionary/pos_group.h
+++ b/src/dictionary/pos_group.h
@@ -33,12 +33,13 @@
 #include "base/port.h"
 
 namespace mozc {
+namespace dictionary {
 
 // Manages pos grouping rule.
 class PosGroup {
  public:
   explicit PosGroup(const uint8 *lid_group) : lid_group_(lid_group) {}
-  virtual ~PosGroup() {}
+  ~PosGroup() {}
 
   // Returns grouped pos id based on an array pre-generated from
   // data/rules/user_segment_history_pos_group.def.
@@ -49,6 +50,7 @@
   DISALLOW_COPY_AND_ASSIGN(PosGroup);
 };
 
+}  // namespace dictionary
 }  // namespace mozc
 
 #endif  // MOZC_DICTIONARY_POS_GROUP_H_
diff --git a/src/dictionary/system/system_dictionary_builder.h b/src/dictionary/system/system_dictionary_builder.h
index fd0fcf9..5026b78 100644
--- a/src/dictionary/system/system_dictionary_builder.h
+++ b/src/dictionary/system/system_dictionary_builder.h
@@ -41,9 +41,6 @@
 #include "dictionary/system/words_info.h"
 
 namespace mozc {
-struct DictionaryFileSection;
-struct Token;
-
 namespace storage {
 namespace louds {
 class BitVectorBasedArrayBuilder;
@@ -52,7 +49,9 @@
 }  // namespace storage
 
 namespace dictionary {
+
 class SystemDictionaryCodecInterface;
+struct Token;
 
 class SystemDictionaryBuilder {
  public:
diff --git a/src/dictionary/system/value_dictionary.h b/src/dictionary/system/value_dictionary.h
index b38b102..d0ed54d 100644
--- a/src/dictionary/system/value_dictionary.h
+++ b/src/dictionary/system/value_dictionary.h
@@ -43,11 +43,10 @@
 #include "storage/louds/louds_trie.h"
 
 namespace mozc {
-class POSMatcher;
-
 namespace dictionary {
 
 class DictionaryFile;
+class POSMatcher;
 class SystemDictionaryCodecInterface;
 
 class ValueDictionary : public DictionaryInterface {
diff --git a/src/dictionary/system/words_info.h b/src/dictionary/system/words_info.h
index 71c5183..c9957e0 100644
--- a/src/dictionary/system/words_info.h
+++ b/src/dictionary/system/words_info.h
@@ -33,11 +33,11 @@
 #define MOZC_DICTIONARY_SYSTEM_WORDS_INFO_H_
 
 namespace mozc {
+namespace dictionary {
+
 struct Token;
 
-namespace dictionary {
 // TODO(toshiyuki): These could be implemented by protobuf
-
 // Represents each token info
 struct TokenInfo {
   enum PosType {
diff --git a/src/dictionary/text_dictionary_loader.cc b/src/dictionary/text_dictionary_loader.cc
index 97b2af0..9aaa3ed 100644
--- a/src/dictionary/text_dictionary_loader.cc
+++ b/src/dictionary/text_dictionary_loader.cc
@@ -54,6 +54,7 @@
              "Reserve the specified size of token buffer in advance.");
 
 namespace mozc {
+namespace dictionary {
 namespace {
 
 // Functor to sort a sequence of Tokens first by value and then by key.
@@ -334,4 +335,5 @@
   return token.release();
 }
 
+}  // namespace dictionary
 }  // namespace mozc
diff --git a/src/dictionary/text_dictionary_loader.h b/src/dictionary/text_dictionary_loader.h
index d32f7f5..11dce20 100644
--- a/src/dictionary/text_dictionary_loader.h
+++ b/src/dictionary/text_dictionary_loader.h
@@ -39,6 +39,7 @@
 // for FRIEND_TEST
 
 namespace mozc {
+namespace dictionary {
 
 struct Token;
 class POSMatcher;
@@ -109,6 +110,7 @@
   FRIEND_TEST(TextDictionaryLoaderTest, RewriteSpecialTokenTest);
 };
 
+}  // namespace dictionary
 }  // namespace mozc
 
 #endif  // MOZC_DICTIONARY_TEXT_DICTIONARY_LOADER_H_
diff --git a/src/dictionary/text_dictionary_loader_test.cc b/src/dictionary/text_dictionary_loader_test.cc
index 75ed0e1..8d9a933 100644
--- a/src/dictionary/text_dictionary_loader_test.cc
+++ b/src/dictionary/text_dictionary_loader_test.cc
@@ -43,16 +43,18 @@
 DECLARE_string(test_tmpdir);
 
 namespace mozc {
+namespace dictionary {
 namespace {
 
 const char kTextLines[] =
-"key_test1\t0\t0\t1\tvalue_test1\n"
-"foo\t1\t2\t3\tbar\n"
-"buz\t10\t20\t30\tfoobar\n";
+    "key_test1\t0\t0\t1\tvalue_test1\n"
+    "foo\t1\t2\t3\tbar\n"
+    "buz\t10\t20\t30\tfoobar\n";
 
 const char kReadingCorrectionLines[] =
     "bar\tfoo\tfoo_correct\n"
     "foobar\tfoobar_error\tfoobar_correct\n";
+
 }  // namespace
 
 class TextDictionaryLoaderTest : public ::testing::Test {
@@ -254,4 +256,5 @@
   EXPECT_EQ(30 + 2302, tokens[3]->cost);
 }
 
+}  // namespace dictionary
 }  // namespace mozc
diff --git a/src/dictionary/user_dictionary_importer.h b/src/dictionary/user_dictionary_importer.h
index 318d79e..2ff54b3 100644
--- a/src/dictionary/user_dictionary_importer.h
+++ b/src/dictionary/user_dictionary_importer.h
@@ -206,4 +206,5 @@
 };
 
 }  // namespace mozc
+
 #endif  // MOZC_DICTIONARY_USER_DICTIONARY_IMPORTER_H_
diff --git a/src/dictionary/user_dictionary_stub.h b/src/dictionary/user_dictionary_stub.h
index cb99ac1..3fb1f7f 100644
--- a/src/dictionary/user_dictionary_stub.h
+++ b/src/dictionary/user_dictionary_stub.h
@@ -30,10 +30,10 @@
 #ifndef MOZC_DICTIONARY_USER_DICTIONARY_STUB_H_
 #define MOZC_DICTIONARY_USER_DICTIONARY_STUB_H_
 
-#include "base/string_piece.h"
 #include "dictionary/dictionary_interface.h"
 
 namespace mozc {
+namespace dictionary {
 
 class UserDictionaryStub : public DictionaryInterface {
  public:
@@ -66,6 +66,7 @@
   }
 };
 
+}  // namespace dictionary
 }  // namespace mozc
 
 #endif  // MOZC_DICTIONARY_USER_DICTIONARY_STUB_H_
diff --git a/src/dictionary/user_pos.cc b/src/dictionary/user_pos.cc
index 1351ab9..f01ac88 100644
--- a/src/dictionary/user_pos.cc
+++ b/src/dictionary/user_pos.cc
@@ -36,11 +36,12 @@
 #include "base/util.h"
 
 namespace mozc {
+namespace dictionary {
 
 UserPOS::UserPOS(const POSToken *pos_token_array)
     : pos_token_array_(pos_token_array) {
   DCHECK(pos_token_array_);
-  for (size_t i = 0; pos_token_array_[i].pos != NULL; ++i) {
+  for (size_t i = 0; pos_token_array_[i].pos != nullptr; ++i) {
     pos_map_.insert(make_pair(string(pos_token_array_[i].pos),
                               &pos_token_array_[i]));
   }
@@ -49,7 +50,7 @@
 
 void UserPOS::GetPOSList(vector<string> *pos_list) const {
   pos_list->clear();
-  for (size_t i = 0; pos_token_array_[i].pos != NULL; ++i) {
+  for (size_t i = 0; pos_token_array_[i].pos != nullptr; ++i) {
     pos_list->push_back(pos_token_array_[i].pos);
   }
 }
@@ -80,7 +81,7 @@
   if (key.empty() ||
       value.empty() ||
       pos.empty() ||
-      tokens == NULL) {
+      tokens == nullptr) {
     return false;
   }
 
@@ -140,4 +141,5 @@
   return true;
 }
 
+}  // namespace dictionary
 }  // namespace mozc
diff --git a/src/dictionary/user_pos.h b/src/dictionary/user_pos.h
index e8ef0d1..4195f5c 100644
--- a/src/dictionary/user_pos.h
+++ b/src/dictionary/user_pos.h
@@ -38,6 +38,7 @@
 #include "dictionary/user_pos_interface.h"
 
 namespace mozc {
+namespace dictionary {
 
 class UserPOS : public UserPOSInterface {
  public:
@@ -67,11 +68,12 @@
 
  private:
   const POSToken *pos_token_array_;
-  map<string, const POSToken*> pos_map_;
+  map<string, const POSToken *> pos_map_;
 
   DISALLOW_COPY_AND_ASSIGN(UserPOS);
 };
 
-}  // mozc
+}  // namespace dictionary
+}  // namespace mozc
 
 #endif  // MOZC_DICTIONARY_USER_POS_H_
diff --git a/src/dictionary/user_pos_test.cc b/src/dictionary/user_pos_test.cc
index b9388fe..eda7469 100644
--- a/src/dictionary/user_pos_test.cc
+++ b/src/dictionary/user_pos_test.cc
@@ -41,6 +41,8 @@
 #include "testing/base/public/gunit.h"
 
 namespace mozc {
+namespace dictionary {
+namespace {
 
 class UserPOSTest : public ::testing::Test {
  protected:
@@ -143,4 +145,6 @@
   }
 }
 
+}  // namespace
+}  // namespace dictionary
 }  // namespace mozc
diff --git a/src/engine/engine.cc b/src/engine/engine.cc
index e615757..a64cd9b 100644
--- a/src/engine/engine.cc
+++ b/src/engine/engine.cc
@@ -59,11 +59,13 @@
 #include "rewriter/rewriter_interface.h"
 
 using mozc::dictionary::DictionaryImpl;
+using mozc::dictionary::PosGroup;
 using mozc::dictionary::SuffixDictionary;
 using mozc::dictionary::SuffixToken;
 using mozc::dictionary::SuppressionDictionary;
 using mozc::dictionary::SystemDictionary;
 using mozc::dictionary::UserDictionary;
+using mozc::dictionary::UserPOS;
 using mozc::dictionary::ValueDictionary;
 
 namespace mozc {
diff --git a/src/engine/engine.h b/src/engine/engine.h
index 39f456d..03355df 100644
--- a/src/engine/engine.h
+++ b/src/engine/engine.h
@@ -32,6 +32,7 @@
 
 #include "base/port.h"
 #include "base/scoped_ptr.h"
+#include "dictionary/dictionary_interface.h"
 #include "dictionary/pos_group.h"
 #include "dictionary/user_dictionary.h"
 #include "engine/engine_interface.h"
@@ -41,7 +42,6 @@
 class Connector;
 class ConverterInterface;
 class DataManagerInterface;
-class DictionaryInterface;
 class ImmutableConverterInterface;
 class PredictorInterface;
 class RewriterInterface;
@@ -80,9 +80,9 @@
   scoped_ptr<const Connector> connector_;
   scoped_ptr<const Segmenter> segmenter_;
   scoped_ptr<dictionary::UserDictionary> user_dictionary_;
-  scoped_ptr<DictionaryInterface> suffix_dictionary_;
-  scoped_ptr<DictionaryInterface> dictionary_;
-  scoped_ptr<const PosGroup> pos_group_;
+  scoped_ptr<dictionary::DictionaryInterface> suffix_dictionary_;
+  scoped_ptr<dictionary::DictionaryInterface> dictionary_;
+  scoped_ptr<const dictionary::PosGroup> pos_group_;
   scoped_ptr<ImmutableConverterInterface> immutable_converter_;
   scoped_ptr<const SuggestionFilter> suggestion_filter_;
 
diff --git a/src/gui/dictionary_tool/dictionary_tool.cc b/src/gui/dictionary_tool/dictionary_tool.cc
index 1fc5975..241d8fb 100644
--- a/src/gui/dictionary_tool/dictionary_tool.cc
+++ b/src/gui/dictionary_tool/dictionary_tool.cc
@@ -312,7 +312,7 @@
       client_(client::ClientFactory::NewClient()),
       is_available_(true),
       max_entry_size_(mozc::UserDictionaryStorage::max_entry_size()),
-      user_pos_(new UserPOS(
+      user_pos_(new dictionary::UserPOS(
           UserPosManager::GetUserPosManager()->GetUserPOSData())) {
   setupUi(this);
 
diff --git a/src/gui/word_register_dialog/word_register_dialog.cc b/src/gui/word_register_dialog/word_register_dialog.cc
index 8fd07e7..d6f21bc 100644
--- a/src/gui/word_register_dialog/word_register_dialog.cc
+++ b/src/gui/word_register_dialog/word_register_dialog.cc
@@ -100,7 +100,7 @@
           UserDictionaryUtil::GetUserDictionaryFileName())),
       client_(client::ClientFactory::NewClient()),
       window_title_(tr("Mozc")),
-      user_pos_(new UserPOS(
+      user_pos_(new dictionary::UserPOS(
           UserPosManager::GetUserPosManager()->GetUserPOSData())) {
   setupUi(this);
   setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowStaysOnTopHint);
diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt
index c880dbb..5e3a906 100644
--- a/src/mozc_version_template.txt
+++ b/src/mozc_version_template.txt
@@ -1,6 +1,6 @@
 MAJOR=2
 MINOR=17
-BUILD=2088
+BUILD=2089
 REVISION=102
 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
 # downloaded by NaCl Mozc.
diff --git a/src/prediction/dictionary_predictor.cc b/src/prediction/dictionary_predictor.cc
index 8b4230d..aeedba9 100644
--- a/src/prediction/dictionary_predictor.cc
+++ b/src/prediction/dictionary_predictor.cc
@@ -74,6 +74,10 @@
 
 DECLARE_bool(enable_typing_correction);
 
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::Token;
+
 namespace mozc {
 namespace {
 
@@ -172,7 +176,7 @@
 }  // namespace
 
 class DictionaryPredictor::PredictiveLookupCallback :
-      public mozc::DictionaryInterface::Callback {
+      public DictionaryInterface::Callback {
  public:
   PredictiveLookupCallback(DictionaryPredictor::PredictionTypes types,
                            size_t limit, size_t original_key_len,
diff --git a/src/prediction/dictionary_predictor.h b/src/prediction/dictionary_predictor.h
index 341707f..d4aae26 100644
--- a/src/prediction/dictionary_predictor.h
+++ b/src/prediction/dictionary_predictor.h
@@ -35,7 +35,9 @@
 #include <vector>
 
 #include "base/util.h"
+#include "dictionary/dictionary_interface.h"
 #include "dictionary/dictionary_token.h"
+#include "dictionary/pos_matcher.h"
 #include "prediction/predictor_interface.h"
 // for FRIEND_TEST()
 #include "testing/base/public/gunit_prod.h"
@@ -45,9 +47,7 @@
 class Connector;
 class ConversionRequest;
 class ConverterInterface;
-class DictionaryInterface;
 class ImmutableConverterInterface;
-class POSMatcher;
 class Segmenter;
 class Segments;
 class SuggestionFilter;
@@ -59,11 +59,11 @@
   // pointers are not owned by the class and to be deleted by the caller.
   DictionaryPredictor(const ConverterInterface *converter,
                       const ImmutableConverterInterface *immutable_converter,
-                      const DictionaryInterface *dictionary,
-                      const DictionaryInterface *suffix_dictionary,
+                      const dictionary::DictionaryInterface *dictionary,
+                      const dictionary::DictionaryInterface *suffix_dictionary,
                       const Connector *connector,
                       const Segmenter *segmenter,
-                      const POSMatcher *pos_matcher,
+                      const dictionary::POSMatcher *pos_matcher,
                       const SuggestionFilter *suggestion_filter);
   virtual ~DictionaryPredictor();
 
@@ -105,9 +105,11 @@
     Result() : types(NO_PREDICTION), wcost(0), cost(0), lid(0), rid(0),
                candidate_attributes(0), consumed_key_size(0) {}
 
-    void InitializeByTokenAndTypes(const Token &token, PredictionTypes types);
-    void SetTypesAndTokenAttributes(PredictionTypes prediction_types,
-                                    Token::AttributesBitfield token_attr);
+    void InitializeByTokenAndTypes(const dictionary::Token &token,
+                                   PredictionTypes types);
+    void SetTypesAndTokenAttributes(
+        PredictionTypes prediction_types,
+        dictionary::Token::AttributesBitfield token_attr);
 
     string key;
     string value;
@@ -240,12 +242,12 @@
                                    vector<Result> *results) const;
 
   // Changes the prediction type for irrelevant bigram candidate.
-  void CheckBigramResult(const Token &history_token,
+  void CheckBigramResult(const dictionary::Token &history_token,
                          const Util::ScriptType history_ctype,
                          const Util::ScriptType last_history_ctype,
                          Result *result) const;
 
-  void GetPredictiveResults(const DictionaryInterface &dictionary,
+  void GetPredictiveResults(const dictionary::DictionaryInterface &dictionary,
                             const string &history_key,
                             const ConversionRequest &request,
                             const Segments &segments,
@@ -253,29 +255,31 @@
                             size_t lookup_limit,
                             vector<Result> *results) const;
 
-  void GetPredictiveResultsForBigram(const DictionaryInterface &dictionary,
-                                     const string &history_key,
-                                     const string &history_value,
-                                     const ConversionRequest &request,
-                                     const Segments &segments,
-                                     PredictionTypes types,
-                                     size_t lookup_limit,
-                                     vector<Result> *results) const;
+  void GetPredictiveResultsForBigram(
+      const dictionary::DictionaryInterface &dictionary,
+      const string &history_key,
+      const string &history_value,
+      const ConversionRequest &request,
+      const Segments &segments,
+      PredictionTypes types,
+      size_t lookup_limit,
+      vector<Result> *results) const;
 
   // Performs a custom look up for English words where case-conversion might be
   // applied to lookup key and/or output results.
-  void GetPredictiveResultsForEnglish(const DictionaryInterface &dictionary,
-                                      const string &history_key,
-                                      const ConversionRequest &request,
-                                      const Segments &segments,
-                                      PredictionTypes types,
-                                      size_t lookup_limit,
-                                      vector<Result> *results) const;
+  void GetPredictiveResultsForEnglish(
+      const dictionary::DictionaryInterface &dictionary,
+      const string &history_key,
+      const ConversionRequest &request,
+      const Segments &segments,
+      PredictionTypes types,
+      size_t lookup_limit,
+      vector<Result> *results) const;
 
   // Performs look-ups using type-corrected queries from composer. Usually
   // involves multiple look-ups from dictionary.
   void GetPredictiveResultsUsingTypingCorrection(
-      const DictionaryInterface &dictionary,
+      const dictionary::DictionaryInterface &dictionary,
       const string &history_key,
       const ConversionRequest &request,
       const Segments &segments,
@@ -421,8 +425,8 @@
 
   const ConverterInterface *converter_;
   const ImmutableConverterInterface *immutable_converter_;
-  const DictionaryInterface *dictionary_;
-  const DictionaryInterface *suffix_dictionary_;
+  const dictionary::DictionaryInterface *dictionary_;
+  const dictionary::DictionaryInterface *suffix_dictionary_;
   const Connector *connector_;
   const Segmenter *segmenter_;
   const SuggestionFilter *suggestion_filter_;
@@ -431,6 +435,7 @@
 
   DISALLOW_COPY_AND_ASSIGN(DictionaryPredictor);
 };
+
 }  // namespace mozc
 
 #endif  // MOZC_PREDICTION_DICTIONARY_PREDICTOR_H_
diff --git a/src/prediction/dictionary_predictor_test.cc b/src/prediction/dictionary_predictor_test.cc
index c8c9e8a..c262efe 100644
--- a/src/prediction/dictionary_predictor_test.cc
+++ b/src/prediction/dictionary_predictor_test.cc
@@ -74,10 +74,15 @@
 #include "transliteration/transliteration.h"
 
 using ::testing::_;
+
+using mozc::dictionary::DictionaryInterface;
 using mozc::dictionary::DictionaryMock;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::PosGroup;
 using mozc::dictionary::SuffixDictionary;
 using mozc::dictionary::SuffixToken;
 using mozc::dictionary::SuppressionDictionary;
+using mozc::dictionary::Token;
 
 DECLARE_string(test_tmpdir);
 DECLARE_bool(enable_expansion_for_dictionary_predictor);
diff --git a/src/prediction/user_history_predictor.cc b/src/prediction/user_history_predictor.cc
index c0c3ce8..2075f60 100644
--- a/src/prediction/user_history_predictor.cc
+++ b/src/prediction/user_history_predictor.cc
@@ -59,6 +59,8 @@
 
 using mozc::commands::Request;
 using mozc::dictionary::SuppressionDictionary;
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
 
 // This flag is set by predictor.cc
 // We can remove this after the ambiguity expansion feature get stable.
diff --git a/src/prediction/user_history_predictor.h b/src/prediction/user_history_predictor.h
index 2d1f361..e04563a 100644
--- a/src/prediction/user_history_predictor.h
+++ b/src/prediction/user_history_predictor.h
@@ -40,6 +40,8 @@
 #include "base/scoped_ptr.h"
 #include "base/string_piece.h"
 #include "base/trie.h"
+#include "dictionary/dictionary_interface.h"
+#include "dictionary/pos_matcher.h"
 #include "dictionary/suppression_dictionary.h"
 #include "prediction/predictor_interface.h"
 #include "prediction/user_history_predictor.pb.h"
@@ -54,8 +56,6 @@
 }  // namespace storage
 
 class ConversionRequest;
-class DictionaryInterface;
-class POSMatcher;
 class Segment;
 class Segments;
 class UserHistoryPredictorSyncer;
@@ -84,8 +84,8 @@
 class UserHistoryPredictor : public PredictorInterface {
  public:
   UserHistoryPredictor(
-      const DictionaryInterface *dictionary,
-      const POSMatcher *pos_matcher,
+      const dictionary::DictionaryInterface *dictionary,
+      const dictionary::POSMatcher *pos_matcher,
       const dictionary::SuppressionDictionary *suppression_dictionary,
       bool enable_content_word_learning);
   virtual ~UserHistoryPredictor();
@@ -493,8 +493,8 @@
   // such like password.
   bool IsPrivacySensitive(const Segments *segments) const;
 
-  const DictionaryInterface *dictionary_;
-  const POSMatcher *pos_matcher_;
+  const dictionary::DictionaryInterface *dictionary_;
+  const dictionary::POSMatcher *pos_matcher_;
   const dictionary::SuppressionDictionary *suppression_dictionary_;
   const string predictor_name_;
 
diff --git a/src/prediction/user_history_predictor_test.cc b/src/prediction/user_history_predictor_test.cc
index a9f8312..e5db5dd 100644
--- a/src/prediction/user_history_predictor_test.cc
+++ b/src/prediction/user_history_predictor_test.cc
@@ -59,6 +59,7 @@
 using mozc::commands::Request;
 using mozc::dictionary::DictionaryMock;
 using mozc::dictionary::SuppressionDictionary;
+using mozc::dictionary::Token;
 
 namespace mozc {
 namespace {
diff --git a/src/rewriter/collocation_rewriter.h b/src/rewriter/collocation_rewriter.h
index fc0ceac..88ddd49 100644
--- a/src/rewriter/collocation_rewriter.h
+++ b/src/rewriter/collocation_rewriter.h
@@ -36,9 +36,10 @@
 #include "rewriter/rewriter_interface.h"
 
 namespace mozc {
-class ConversionRequest;
+
 class DataManagerInterface;
-class POSMatcher;
+
+namespace dictionary { class POSMatcher; }
 
 class CollocationRewriter : public RewriterInterface {
  public:
@@ -58,7 +59,7 @@
                                Segment *seg) const;
   bool RewriteCollocation(Segments *segments) const;
 
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
   const uint16 first_name_id_;
   const uint16 last_name_id_;
 
@@ -73,6 +74,7 @@
   // very low (0.001% by default).
   scoped_ptr<SuppressionFilter> suppression_filter_;
 };
+
 }  // namespace mozc
 
 #endif  // MOZC_REWRITER_COLLOCATION_REWRITER_H_
diff --git a/src/rewriter/collocation_rewriter_test.cc b/src/rewriter/collocation_rewriter_test.cc
index a6d2591..7a27285 100644
--- a/src/rewriter/collocation_rewriter_test.cc
+++ b/src/rewriter/collocation_rewriter_test.cc
@@ -43,6 +43,8 @@
 
 DECLARE_string(test_tmpdir);
 
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 
 class CollocationRewriterTest : public ::testing::Test {
diff --git a/src/rewriter/dictionary_generator.cc b/src/rewriter/dictionary_generator.cc
index 0269788..37e19ed 100644
--- a/src/rewriter/dictionary_generator.cc
+++ b/src/rewriter/dictionary_generator.cc
@@ -82,8 +82,8 @@
 DictionaryGenerator::DictionaryGenerator()
     : token_pool_(new ObjectPool<Token>(kTokenSize)),
       token_map_(new map<uint64, Token *>),
-      user_pos_(
-          new UserPOS(UserPosManager::GetUserPosManager()->GetUserPOSData())),
+      user_pos_(new dictionary::UserPOS(
+          UserPosManager::GetUserPosManager()->GetUserPOSData())),
       open_bracket_id_(UserPosManager::GetUserPosManager()->GetPOSMatcher()
                        ->GetOpenBracketId()),
       close_bracket_id_(UserPosManager::GetUserPosManager()->GetPOSMatcher()
diff --git a/src/rewriter/focus_candidate_rewriter.h b/src/rewriter/focus_candidate_rewriter.h
index 658cb67..52208ea 100644
--- a/src/rewriter/focus_candidate_rewriter.h
+++ b/src/rewriter/focus_candidate_rewriter.h
@@ -36,11 +36,11 @@
 
 namespace mozc {
 
-class ConversionRequest;
 class DataManagerInterface;
-class POSMatcher;
 struct CounterSuffixEntry;
 
+namespace dictionary { class POSMatcher; }
+
 class FocusCandidateRewriter : public RewriterInterface  {
  public:
   explicit FocusCandidateRewriter(const DataManagerInterface *data_manager);
@@ -84,7 +84,7 @@
 
   const CounterSuffixEntry *suffix_array_;
   size_t suffix_array_size_;
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
 
   DISALLOW_COPY_AND_ASSIGN(FocusCandidateRewriter);
 };
diff --git a/src/rewriter/language_aware_rewriter.cc b/src/rewriter/language_aware_rewriter.cc
index f6bf98a..286d547 100644
--- a/src/rewriter/language_aware_rewriter.cc
+++ b/src/rewriter/language_aware_rewriter.cc
@@ -43,6 +43,9 @@
 #include "session/commands.pb.h"
 #include "usage_stats/usage_stats.h"
 
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 
 LanguageAwareRewriter::LanguageAwareRewriter(
diff --git a/src/rewriter/language_aware_rewriter.h b/src/rewriter/language_aware_rewriter.h
index 4f0d878..2e1ef0e 100644
--- a/src/rewriter/language_aware_rewriter.h
+++ b/src/rewriter/language_aware_rewriter.h
@@ -30,23 +30,18 @@
 #ifndef MOZC_REWRITER_LANGUAGE_AWARE_REWRITER_H_
 #define MOZC_REWRITER_LANGUAGE_AWARE_REWRITER_H_
 
-#include <string>
 #include "base/port.h"
 #include "converter/segments.h"
+#include "dictionary/dictionary_interface.h"
+#include "dictionary/pos_matcher.h"
 #include "rewriter/rewriter_interface.h"
 
 namespace mozc {
 
-class ConversionRequest;
-class DictionaryInterface;
-class POSMatcher;
-class Segments;
-class Segment;
-
 class LanguageAwareRewriter : public RewriterInterface {
  public:
-  LanguageAwareRewriter(const POSMatcher &pos_matcher,
-                        const DictionaryInterface *dictionary);
+  LanguageAwareRewriter(const dictionary::POSMatcher &pos_matcher,
+                          const dictionary::DictionaryInterface *dictionary);
   virtual ~LanguageAwareRewriter();
 
   virtual int capability(const ConversionRequest &request) const;
@@ -62,7 +57,9 @@
                    Segments *segments) const;
 
   const uint16 unknown_id_;
-  const DictionaryInterface *dictionary_;
+  const dictionary::DictionaryInterface *dictionary_;
+
+  DISALLOW_COPY_AND_ASSIGN(LanguageAwareRewriter);
 };
 
 }  // namespace mozc
diff --git a/src/rewriter/language_aware_rewriter_test.cc b/src/rewriter/language_aware_rewriter_test.cc
index 7ecb0fa..2097b41 100644
--- a/src/rewriter/language_aware_rewriter_test.cc
+++ b/src/rewriter/language_aware_rewriter_test.cc
@@ -56,6 +56,7 @@
 DECLARE_string(test_tmpdir);
 
 using mozc::dictionary::DictionaryMock;
+using mozc::dictionary::Token;
 
 namespace mozc {
 namespace {
diff --git a/src/rewriter/number_compound_util.cc b/src/rewriter/number_compound_util.cc
index 822b634..e119406 100644
--- a/src/rewriter/number_compound_util.cc
+++ b/src/rewriter/number_compound_util.cc
@@ -35,6 +35,8 @@
 #include "dictionary/pos_matcher.h"
 #include "rewriter/counter_suffix.h"
 
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 namespace number_compound_util {
 namespace {
diff --git a/src/rewriter/number_compound_util.h b/src/rewriter/number_compound_util.h
index dfde5bc..21e1a90 100644
--- a/src/rewriter/number_compound_util.h
+++ b/src/rewriter/number_compound_util.h
@@ -40,8 +40,8 @@
 
 namespace mozc {
 
-class POSMatcher;
 struct CounterSuffixEntry;
+namespace dictionary {class POSMatcher; }
 
 namespace number_compound_util {
 
@@ -71,7 +71,8 @@
 //   3) lid is general nound and content value consists of number and counter
 //      suffix, where counter suffix needs to be provided as a sorted array.
 bool IsNumber(const CounterSuffixEntry *suffix_array, size_t suffix_array_size,
-              const POSMatcher &pos_matcher, const Segment::Candidate &cand);
+              const dictionary::POSMatcher &pos_matcher,
+              const Segment::Candidate &cand);
 
 }  // namespace number_compound_util
 }  // namespace mozc
diff --git a/src/rewriter/number_compound_util_test.cc b/src/rewriter/number_compound_util_test.cc
index d58b448..e8b6fa8 100644
--- a/src/rewriter/number_compound_util_test.cc
+++ b/src/rewriter/number_compound_util_test.cc
@@ -34,6 +34,8 @@
 #include "rewriter/counter_suffix.h"
 #include "testing/base/public/gunit.h"
 
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 namespace number_compound_util {
 
diff --git a/src/rewriter/number_rewriter.cc b/src/rewriter/number_rewriter.cc
index 3fd0990..c04c412 100644
--- a/src/rewriter/number_rewriter.cc
+++ b/src/rewriter/number_rewriter.cc
@@ -47,6 +47,8 @@
 #include "rewriter/number_compound_util.h"
 #include "session/commands.pb.h"
 
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 namespace {
 
diff --git a/src/rewriter/number_rewriter.h b/src/rewriter/number_rewriter.h
index f89dbb4..83ead84 100644
--- a/src/rewriter/number_rewriter.h
+++ b/src/rewriter/number_rewriter.h
@@ -31,14 +31,12 @@
 #define MOZC_REWRITER_NUMBER_REWRITER_H_
 
 #include "base/port.h"
+#include "dictionary/pos_matcher.h"
 #include "rewriter/rewriter_interface.h"
 
 namespace mozc {
 
-class ConversionRequest;
 class DataManagerInterface;
-class POSMatcher;
-class Segments;
 struct CounterSuffixEntry;
 
 class NumberRewriter : public RewriterInterface  {
@@ -54,7 +52,7 @@
  private:
   const CounterSuffixEntry *suffix_array_;
   size_t suffix_array_size_;
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
 
   DISALLOW_COPY_AND_ASSIGN(NumberRewriter);
 };
diff --git a/src/rewriter/number_rewriter_test.cc b/src/rewriter/number_rewriter_test.cc
index 4ef869d..b0673c9 100644
--- a/src/rewriter/number_rewriter_test.cc
+++ b/src/rewriter/number_rewriter_test.cc
@@ -51,6 +51,8 @@
 
 DECLARE_string(test_tmpdir);
 
+using mozc::dictionary::POSMatcher;
+
 // To show the value of size_t, 'z' speficier should be used.
 // But MSVC doesn't support it yet so use 'l' instead.
 #ifdef _MSC_VER
@@ -60,8 +62,8 @@
 #endif  // _MSC_VER
 
 namespace mozc {
-
 namespace {
+
 // const char kKanjiDescription[]  = 漢数字";
 // const char kArabicDescription[] = "数字";
 // const char kOldKanjiDescription[]  = "大字";
diff --git a/src/rewriter/rewriter.cc b/src/rewriter/rewriter.cc
index d0d3416..d5bb626 100644
--- a/src/rewriter/rewriter.cc
+++ b/src/rewriter/rewriter.cc
@@ -68,6 +68,10 @@
 
 DEFINE_bool(use_history_rewriter, true, "Use history rewriter or not.");
 
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::PosGroup;
+
 namespace {
 // When updating the emoji dictionary,
 // 1. Edit mozc/data/emoji/emoji_data.tsv,
diff --git a/src/rewriter/rewriter.h b/src/rewriter/rewriter.h
index 2d79c1f..2092714 100644
--- a/src/rewriter/rewriter.h
+++ b/src/rewriter/rewriter.h
@@ -30,22 +30,25 @@
 #ifndef MOZC_REWRITER_REWRITER_H_
 #define MOZC_REWRITER_REWRITER_H_
 
+#include "base/port.h"
+#include "dictionary/dictionary_interface.h"
+#include "dictionary/pos_group.h"
 #include "rewriter/merger_rewriter.h"
 
 namespace mozc {
 
 class ConverterInterface;
 class DataManagerInterface;
-class DictionaryInterface;
-class POSMatcher;
-class PosGroup;
 
 class RewriterImpl : public MergerRewriter {
  public:
   RewriterImpl(const ConverterInterface *parent_converter,
                const DataManagerInterface *data_manager,
-               const PosGroup *pos_group,
-               const DictionaryInterface *dictionary);
+               const dictionary::PosGroup *pos_group,
+               const dictionary::DictionaryInterface *dictionary);
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(RewriterImpl);
 };
 
 }  // namespace mozc
diff --git a/src/rewriter/rewriter_interface.h b/src/rewriter/rewriter_interface.h
index 58f41c4..c13c4ee 100644
--- a/src/rewriter/rewriter_interface.h
+++ b/src/rewriter/rewriter_interface.h
@@ -32,10 +32,10 @@
 
 #include <cstddef>  // for size_t
 
-namespace mozc {
+#include "converter/conversion_request.h"
+#include "converter/segments.h"
 
-class ConversionRequest;
-class Segments;
+namespace mozc {
 
 class RewriterInterface {
  public:
diff --git a/src/rewriter/rewriter_test.cc b/src/rewriter/rewriter_test.cc
index 68e3805..96af170 100644
--- a/src/rewriter/rewriter_test.cc
+++ b/src/rewriter/rewriter_test.cc
@@ -45,6 +45,9 @@
 
 DECLARE_string(test_tmpdir);
 
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::PosGroup;
+
 namespace mozc {
 namespace {
 
diff --git a/src/rewriter/single_kanji_rewriter.cc b/src/rewriter/single_kanji_rewriter.cc
index eb32cff..9dd73fa 100644
--- a/src/rewriter/single_kanji_rewriter.cc
+++ b/src/rewriter/single_kanji_rewriter.cc
@@ -46,8 +46,9 @@
 #include "rewriter/rewriter_interface.h"
 #include "session/commands.pb.h"
 
-namespace mozc {
+using mozc::dictionary::POSMatcher;
 
+namespace mozc {
 namespace {
 
 struct SingleKanjiList {
diff --git a/src/rewriter/single_kanji_rewriter.h b/src/rewriter/single_kanji_rewriter.h
index 5375f76..53e1e24 100644
--- a/src/rewriter/single_kanji_rewriter.h
+++ b/src/rewriter/single_kanji_rewriter.h
@@ -30,18 +30,14 @@
 #ifndef MOZC_REWRITER_SINGLE_KANJI_REWRITER_H_
 #define MOZC_REWRITER_SINGLE_KANJI_REWRITER_H_
 
+#include "dictionary/pos_matcher.h"
 #include "rewriter/rewriter_interface.h"
 
 namespace mozc {
 
-class ConversionRequest;
-class POSMatcher;
-class Segments;
-class POSMatcher;
-
 class SingleKanjiRewriter : public RewriterInterface  {
  public:
-  explicit SingleKanjiRewriter(const POSMatcher &pos_matcher);
+  explicit SingleKanjiRewriter(const dictionary::POSMatcher &pos_matcher);
   virtual ~SingleKanjiRewriter();
 
   virtual int capability(const ConversionRequest &request) const;
@@ -50,8 +46,9 @@
                        Segments *segments) const;
 
  private:
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
 };
+
 }  // namespace mozc
 
 #endif  // MOZC_REWRITER_SINGLE_KANJI_REWRITER_H_
diff --git a/src/rewriter/single_kanji_rewriter_test.cc b/src/rewriter/single_kanji_rewriter_test.cc
index f292d62..41d72ae 100644
--- a/src/rewriter/single_kanji_rewriter_test.cc
+++ b/src/rewriter/single_kanji_rewriter_test.cc
@@ -46,6 +46,8 @@
 
 DECLARE_string(test_tmpdir);
 
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 
 class SingleKanjiRewriterTest : public ::testing::Test {
diff --git a/src/rewriter/transliteration_rewriter.cc b/src/rewriter/transliteration_rewriter.cc
index fc67768..ce9a5d1 100644
--- a/src/rewriter/transliteration_rewriter.cc
+++ b/src/rewriter/transliteration_rewriter.cc
@@ -303,7 +303,7 @@
 }
 
 TransliterationRewriter::TransliterationRewriter(
-    const POSMatcher &pos_matcher)
+    const dictionary::POSMatcher &pos_matcher)
     : unknown_id_(pos_matcher.GetUnknownId()) {}
 
 TransliterationRewriter::~TransliterationRewriter() {}
diff --git a/src/rewriter/transliteration_rewriter.h b/src/rewriter/transliteration_rewriter.h
index 6ddd84c..1d0c19d 100644
--- a/src/rewriter/transliteration_rewriter.h
+++ b/src/rewriter/transliteration_rewriter.h
@@ -32,20 +32,17 @@
 
 #include <string>
 #include <vector>
+
 #include "base/port.h"
 #include "converter/segments.h"
+#include "dictionary/pos_matcher.h"
 #include "rewriter/rewriter_interface.h"
 
 namespace mozc {
 
-class ConversionRequest;
-class POSMatcher;
-class Segments;
-class Segment;
-
 class TransliterationRewriter : public RewriterInterface  {
  public:
-  explicit TransliterationRewriter(const POSMatcher &pos_matcher);
+  explicit TransliterationRewriter(const dictionary::POSMatcher &pos_matcher);
   virtual ~TransliterationRewriter();
 
   virtual int capability(const ConversionRequest &request) const;
@@ -73,6 +70,8 @@
                                   Segments *segments) const;
 
   const uint16 unknown_id_;
+
+  DISALLOW_COPY_AND_ASSIGN(TransliterationRewriter);
 };
 
 }  // namespace mozc
diff --git a/src/rewriter/usage_rewriter.cc b/src/rewriter/usage_rewriter.cc
index d38de19..75d4448 100644
--- a/src/rewriter/usage_rewriter.cc
+++ b/src/rewriter/usage_rewriter.cc
@@ -41,6 +41,9 @@
 #include "dictionary/pos_matcher.h"
 #include "dictionary/dictionary_interface.h"
 
+using mozc::dictionary::DictionaryInterface;
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 
 UsageRewriter::UsageRewriter(const DataManagerInterface *data_manager,
diff --git a/src/rewriter/usage_rewriter.h b/src/rewriter/usage_rewriter.h
index 9e8bd15..f7d4e36 100644
--- a/src/rewriter/usage_rewriter.h
+++ b/src/rewriter/usage_rewriter.h
@@ -30,27 +30,25 @@
 #ifndef MOZC_REWRITER_USAGE_REWRITER_H_
 #define MOZC_REWRITER_USAGE_REWRITER_H_
 
-#include <list>
 #include <map>
 #include <string>
 #include <utility>
 
 #include "converter/segments.h"
+#include "dictionary/dictionary_interface.h"
+#include "dictionary/pos_matcher.h"
 #include "rewriter/rewriter_interface.h"
 #include "rewriter/usage_rewriter_data_structs.h"
 #include "testing/base/public/gunit_prod.h"  // for FRIEND_TEST()
 
 namespace mozc {
 
-class ConversionRequest;
 class DataManagerInterface;
-class DictionaryInterface;
-class POSMatcher;
 
 class UsageRewriter : public RewriterInterface  {
  public:
   UsageRewriter(const DataManagerInterface *data_manager,
-                const DictionaryInterface *dictionary);
+                const dictionary::DictionaryInterface *dictionary);
   virtual ~UsageRewriter();
   virtual bool Rewrite(const ConversionRequest &request,
                        Segments *segments) const;
@@ -72,8 +70,8 @@
       const Segment::Candidate &candidate) const;
 
   map<StrPair, const UsageDictItem *> key_value_usageitem_map_;
-  const POSMatcher *pos_matcher_;
-  const DictionaryInterface *dictionary_;
+  const dictionary::POSMatcher *pos_matcher_;
+  const dictionary::DictionaryInterface *dictionary_;
   const ConjugationSuffix *base_conjugation_suffix_;
 };
 
diff --git a/src/rewriter/usage_rewriter_test.cc b/src/rewriter/usage_rewriter_test.cc
index ea8fb9c..aa74d95 100644
--- a/src/rewriter/usage_rewriter_test.cc
+++ b/src/rewriter/usage_rewriter_test.cc
@@ -48,6 +48,7 @@
 
 using mozc::dictionary::SuppressionDictionary;
 using mozc::dictionary::UserDictionary;
+using mozc::dictionary::UserPOS;
 
 namespace mozc {
 namespace {
diff --git a/src/rewriter/user_segment_history_rewriter.cc b/src/rewriter/user_segment_history_rewriter.cc
index b33b948..3f17d67 100644
--- a/src/rewriter/user_segment_history_rewriter.cc
+++ b/src/rewriter/user_segment_history_rewriter.cc
@@ -55,13 +55,15 @@
 #include "transliteration/transliteration.h"
 #include "usage_stats/usage_stats.h"
 
+using mozc::config::CharacterFormManager;
+using mozc::config::Config;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::PosGroup;
+using mozc::storage::LRUStorage;
+
 namespace mozc {
-
-using config::CharacterFormManager;
-using config::Config;
-using storage::LRUStorage;
-
 namespace {
+
 const uint32 kValueSize = 4;
 const uint32 kLRUSize   = 20000;
 const uint32 kSeedValue = 0xf28defe3;
diff --git a/src/rewriter/user_segment_history_rewriter.h b/src/rewriter/user_segment_history_rewriter.h
index 2c0a86d..368dd9a 100644
--- a/src/rewriter/user_segment_history_rewriter.h
+++ b/src/rewriter/user_segment_history_rewriter.h
@@ -33,14 +33,12 @@
 #include <string>
 #include <vector>
 
-#include "rewriter/rewriter_interface.h"
 #include "converter/segments.h"
+#include "dictionary/pos_group.h"
+#include "dictionary/pos_matcher.h"
+#include "rewriter/rewriter_interface.h"
 
 namespace mozc {
-class ConversionRequest;
-class POSMatcher;
-class PosGroup;
-
 namespace storage {
 class LRUStorage;
 }  // namespace storage
@@ -53,8 +51,8 @@
     const Segment::Candidate *candidate;
   };
 
-  UserSegmentHistoryRewriter(const POSMatcher *pos_matcher,
-                             const PosGroup *pos_group);
+  UserSegmentHistoryRewriter(const dictionary::POSMatcher *pos_matcher,
+                             const dictionary::PosGroup *pos_group);
   virtual ~UserSegmentHistoryRewriter();
 
   virtual bool Rewrite(const ConversionRequest &request,
@@ -98,9 +96,9 @@
                       Segment *segment) const;
 
 
-  scoped_ptr<mozc::storage::LRUStorage> storage_;
-  const POSMatcher *pos_matcher_;
-  const PosGroup *pos_group_;
+  scoped_ptr<storage::LRUStorage> storage_;
+  const dictionary::POSMatcher *pos_matcher_;
+  const dictionary::PosGroup *pos_group_;
 };
 
 }  // namespace mozc
diff --git a/src/rewriter/user_segment_history_rewriter_test.cc b/src/rewriter/user_segment_history_rewriter_test.cc
index 4d2f696..20624d4 100644
--- a/src/rewriter/user_segment_history_rewriter_test.cc
+++ b/src/rewriter/user_segment_history_rewriter_test.cc
@@ -52,13 +52,15 @@
 
 DECLARE_string(test_tmpdir);
 
+using mozc::config::CharacterFormManager;
+using mozc::config::Config;
+using mozc::config::ConfigHandler;
+using mozc::dictionary::POSMatcher;
+using mozc::dictionary::PosGroup;
+
 namespace mozc {
 namespace {
 
-using config::CharacterFormManager;
-using config::Config;
-using config::ConfigHandler;
-
 const size_t kCandidatesSize = 20;
 
 void InitSegments(Segments *segments, size_t size,
diff --git a/src/rewriter/variants_rewriter.cc b/src/rewriter/variants_rewriter.cc
index 86996d2..aa95ac4 100644
--- a/src/rewriter/variants_rewriter.cc
+++ b/src/rewriter/variants_rewriter.cc
@@ -41,9 +41,10 @@
 #include "dictionary/pos_matcher.h"
 #include "session/commands.pb.h"
 
-namespace mozc {
+using mozc::config::CharacterFormManager;
+using mozc::dictionary::POSMatcher;
 
-using config::CharacterFormManager;
+namespace mozc {
 
 #ifndef OS_ANDROID
 // "ひらがな"
diff --git a/src/rewriter/variants_rewriter.h b/src/rewriter/variants_rewriter.h
index 6302309..9424637 100644
--- a/src/rewriter/variants_rewriter.h
+++ b/src/rewriter/variants_rewriter.h
@@ -35,13 +35,11 @@
 
 #include "base/port.h"
 #include "converter/segments.h"
+#include "dictionary/pos_matcher.h"
 #include "rewriter/rewriter_interface.h"
 
 namespace mozc {
 
-class ConversionRequest;
-class POSMatcher;
-
 class VariantsRewriter : public RewriterInterface {
  public:
   // Annotation constants.
@@ -56,7 +54,7 @@
   static const char *kDidYouMean;
   static const char *kYenKigou;
 
-  explicit VariantsRewriter(const POSMatcher *pos_matcher);
+  explicit VariantsRewriter(const dictionary::POSMatcher *pos_matcher);
   virtual ~VariantsRewriter();
   virtual int capability(const ConversionRequest &request) const;
   virtual bool Rewrite(const ConversionRequest &request,
@@ -66,12 +64,15 @@
 
   // Used by UserSegmentHistoryRewriter.
   // TODO(noriyukit): I'd be better to prepare some utility for rewriters.
-  static void SetDescriptionForCandidate(const POSMatcher &pos_matcher,
-                                         Segment::Candidate *candidate);
-  static void SetDescriptionForTransliteration(const POSMatcher &pos_matcher,
-                                               Segment::Candidate *candidate);
-  static void SetDescriptionForPrediction(const POSMatcher &pos_matcher,
-                                          Segment::Candidate *candidate);
+  static void SetDescriptionForCandidate(
+      const dictionary::POSMatcher &pos_matcher,
+      Segment::Candidate *candidate);
+  static void SetDescriptionForTransliteration(
+      const dictionary::POSMatcher &pos_matcher,
+      Segment::Candidate *candidate);
+  static void SetDescriptionForPrediction(
+      const dictionary::POSMatcher &pos_matcher,
+      Segment::Candidate *candidate);
 
  private:
   // 1) Full width / half width description
@@ -98,7 +99,7 @@
     SELECT_VARIANT = 1,  // Select preferred form
   };
 
-  static void SetDescription(const POSMatcher &pos_matcher,
+  static void SetDescription(const dictionary::POSMatcher &pos_matcher,
                              int description_type,
                              Segment::Candidate *candidate);
   bool RewriteSegment(RewriteType type, Segment *seg) const;
@@ -111,7 +112,7 @@
       vector<uint32> *default_inner_segment_boundary,
       vector<uint32> *alternative_inner_segment_boundary) const;
 
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
 };
 
 }  // namespace mozc
diff --git a/src/rewriter/variants_rewriter_test.cc b/src/rewriter/variants_rewriter_test.cc
index c41d664..188306e 100644
--- a/src/rewriter/variants_rewriter_test.cc
+++ b/src/rewriter/variants_rewriter_test.cc
@@ -46,19 +46,21 @@
 
 DECLARE_string(test_tmpdir);
 
+using mozc::config::CharacterFormManager;
+using mozc::config::Config;
+using mozc::config::ConfigHandler;
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
-
-using config::CharacterFormManager;
-using config::Config;
-using config::ConfigHandler;
-
 namespace {
+
 string AppendString(const string &lhs, const string &rhs) {
   if (!rhs.empty()) {
     return lhs + ' ' + rhs;
   }
   return lhs;
 }
+
 }  // namespace
 
 class VariantsRewriterTest : public testing::Test {
diff --git a/src/rewriter/zipcode_rewriter.cc b/src/rewriter/zipcode_rewriter.cc
index 7d84d4e..78160c6 100644
--- a/src/rewriter/zipcode_rewriter.cc
+++ b/src/rewriter/zipcode_rewriter.cc
@@ -38,6 +38,8 @@
 #include "converter/segments.h"
 #include "dictionary/pos_matcher.h"
 
+using mozc::dictionary::POSMatcher;
+
 namespace mozc {
 
 bool ZipcodeRewriter::GetZipcodeCandidatePositions(const Segment &seg,
diff --git a/src/rewriter/zipcode_rewriter.h b/src/rewriter/zipcode_rewriter.h
index eccc29d..bec08c5 100644
--- a/src/rewriter/zipcode_rewriter.h
+++ b/src/rewriter/zipcode_rewriter.h
@@ -31,18 +31,16 @@
 #define MOZC_REWRITER_ZIPCODE_REWRITER_H_
 
 #include <string>
+
+#include "base/port.h"
+#include "dictionary/pos_matcher.h"
 #include "rewriter/rewriter_interface.h"
 
 namespace mozc {
 
-class ConversionRequest;
-class POSMatcher;
-class Segment;
-class Segments;
-
 class ZipcodeRewriter : public RewriterInterface  {
  public:
-  explicit ZipcodeRewriter(const POSMatcher *pos_matcher);
+  explicit ZipcodeRewriter(const dictionary::POSMatcher *pos_matcher);
   virtual ~ZipcodeRewriter();
 
   virtual bool Rewrite(const ConversionRequest &request,
@@ -58,8 +56,11 @@
                        const string &address,
                        Segment *segment) const;
 
-  const POSMatcher *pos_matcher_;
+  const dictionary::POSMatcher *pos_matcher_;
+
+  DISALLOW_COPY_AND_ASSIGN(ZipcodeRewriter);
 };
+
 }  // namespace mozc
 
 #endif  // MOZC_REWRITER_ZIPCODE_REWRITER_H_
diff --git a/src/rewriter/zipcode_rewriter_test.cc b/src/rewriter/zipcode_rewriter_test.cc
index 6aa8cfb..ac1a606 100644
--- a/src/rewriter/zipcode_rewriter_test.cc
+++ b/src/rewriter/zipcode_rewriter_test.cc
@@ -47,8 +47,9 @@
 
 DECLARE_string(test_tmpdir);
 
-namespace mozc {
+using mozc::dictionary::POSMatcher;
 
+namespace mozc {
 namespace {
 
 enum SegmentType {