[code style] lower case namespace

This commit is contained in:
yanyiwu 2015-10-08 21:13:11 +08:00
parent 16b69e35c1
commit ecacf118e6
25 changed files with 39 additions and 38 deletions

View File

@ -4,6 +4,7 @@
1. 支持多个userdict载入多词典路径用英文冒号(:)作为分隔符就当是向环境变量PATH致敬哈哈。 1. 支持多个userdict载入多词典路径用英文冒号(:)作为分隔符就当是向环境变量PATH致敬哈哈。
2. userdict是不带权重的之前对于新的userword默认设置词频权重为最大值现已支持可配置默认使用中位值。 2. userdict是不带权重的之前对于新的userword默认设置词频权重为最大值现已支持可配置默认使用中位值。
3. 修改一些代码风格比如命名空间小写化从CppJieba变成cppjieba。
## v3.2.1 ## v3.2.1

View File

@ -8,11 +8,11 @@
#include "Jieba.hpp" #include "Jieba.hpp"
using namespace husky; using namespace husky;
using namespace CppJieba; using namespace cppjieba;
class ReqHandler: public IRequestHandler { class ReqHandler: public IRequestHandler {
public: public:
ReqHandler(const CppJieba::Jieba& jieba) ReqHandler(const cppjieba::Jieba& jieba)
: jieba_(jieba) { : jieba_(jieba) {
} }
@ -63,7 +63,7 @@ class ReqHandler: public IRequestHandler {
} }
} }
private: private:
const CppJieba::Jieba& jieba_; const cppjieba::Jieba& jieba_;
}; };
bool Run(int argc, char** argv) { bool Run(int argc, char** argv) {
@ -83,7 +83,7 @@ bool Run(int argc, char** argv) {
LogInfo("config info: %s", conf.getConfigInfo().c_str()); LogInfo("config info: %s", conf.getConfigInfo().c_str());
CppJieba::Jieba jieba(dictPath, cppjieba::Jieba jieba(dictPath,
modelPath, modelPath,
userDictPath); userDictPath);

View File

@ -13,7 +13,7 @@
#include "TransCode.hpp" #include "TransCode.hpp"
#include "Trie.hpp" #include "Trie.hpp"
namespace CppJieba { namespace cppjieba {
using namespace limonp; using namespace limonp;

View File

@ -9,7 +9,7 @@
#include "SegmentBase.hpp" #include "SegmentBase.hpp"
#include "TransCode.hpp" #include "TransCode.hpp"
namespace CppJieba { namespace cppjieba {
class FullSegment: public SegmentBase { class FullSegment: public SegmentBase {
public: public:
FullSegment(const string& dictPath) { FullSegment(const string& dictPath) {

View File

@ -3,7 +3,7 @@
#include "limonp/StringUtil.hpp" #include "limonp/StringUtil.hpp"
namespace CppJieba { namespace cppjieba {
using namespace limonp; using namespace limonp;
typedef unordered_map<uint16_t, double> EmitProbMap; typedef unordered_map<uint16_t, double> EmitProbMap;
@ -137,6 +137,6 @@ struct HMMModel {
vector<EmitProbMap* > emitProbVec; vector<EmitProbMap* > emitProbVec;
}; // struct HMMModel }; // struct HMMModel
} // namespace CppJieba } // namespace cppjieba
#endif #endif

View File

@ -8,7 +8,7 @@
#include "HMMModel.hpp" #include "HMMModel.hpp"
#include "SegmentBase.hpp" #include "SegmentBase.hpp"
namespace CppJieba { namespace cppjieba {
class HMMSegment: public SegmentBase { class HMMSegment: public SegmentBase {
public: public:
HMMSegment(const string& filePath) { HMMSegment(const string& filePath) {
@ -175,6 +175,6 @@ class HMMSegment: public SegmentBase {
bool isNeedDestroy_; bool isNeedDestroy_;
}; // class HMMSegment }; // class HMMSegment
} // namespace CppJieba } // namespace cppjieba
#endif #endif

View File

@ -5,7 +5,7 @@
#include "PosTagger.hpp" #include "PosTagger.hpp"
#include "LevelSegment.hpp" #include "LevelSegment.hpp"
namespace CppJieba { namespace cppjieba {
class Jieba { class Jieba {
public: public:

View File

@ -5,7 +5,7 @@
#include <cmath> #include <cmath>
#include <set> #include <set>
namespace CppJieba { namespace cppjieba {
using namespace limonp; using namespace limonp;
/*utf8*/ /*utf8*/

View File

@ -3,7 +3,7 @@
#include "MPSegment.hpp" #include "MPSegment.hpp"
namespace CppJieba { namespace cppjieba {
class LevelSegment: public SegmentBase{ class LevelSegment: public SegmentBase{
public: public:
@ -77,6 +77,6 @@ class LevelSegment: public SegmentBase{
MPSegment mpSeg_; MPSegment mpSeg_;
}; // class LevelSegment }; // class LevelSegment
} // namespace CppJieba } // namespace cppjieba
#endif // CPPJIEBA_LEVELSEGMENT_H #endif // CPPJIEBA_LEVELSEGMENT_H

View File

@ -8,7 +8,7 @@
#include "DictTrie.hpp" #include "DictTrie.hpp"
#include "SegmentBase.hpp" #include "SegmentBase.hpp"
namespace CppJieba { namespace cppjieba {
class MPSegment: public SegmentBase { class MPSegment: public SegmentBase {
public: public:
@ -109,6 +109,6 @@ class MPSegment: public SegmentBase {
bool isNeedDestroy_; bool isNeedDestroy_;
}; // class MPSegment }; // class MPSegment
} // namespace CppJieba } // namespace cppjieba
#endif #endif

View File

@ -6,7 +6,7 @@
#include "HMMSegment.hpp" #include "HMMSegment.hpp"
#include "limonp/StringUtil.hpp" #include "limonp/StringUtil.hpp"
namespace CppJieba { namespace cppjieba {
class MixSegment: public SegmentBase { class MixSegment: public SegmentBase {
public: public:
MixSegment(const string& mpSegDict, const string& hmmSegDict, MixSegment(const string& mpSegDict, const string& hmmSegDict,
@ -86,6 +86,6 @@ class MixSegment: public SegmentBase {
}; // class MixSegment }; // class MixSegment
} // namespace CppJieba } // namespace cppjieba
#endif #endif

View File

@ -5,7 +5,7 @@
#include "limonp/StringUtil.hpp" #include "limonp/StringUtil.hpp"
#include "DictTrie.hpp" #include "DictTrie.hpp"
namespace CppJieba { namespace cppjieba {
using namespace limonp; using namespace limonp;
static const char* const POS_M = "m"; static const char* const POS_M = "m";
@ -74,6 +74,6 @@ class PosTagger {
MixSegment segment_; MixSegment segment_;
}; // class PosTagger }; // class PosTagger
} // namespace CppJieba } // namespace cppjieba
#endif #endif

View File

@ -3,7 +3,7 @@
#include "TransCode.hpp" #include "TransCode.hpp"
namespace CppJieba { namespace cppjieba {
//class PreFilterIterator { //class PreFilterIterator {
// public: // public:
@ -56,6 +56,6 @@ class PreFilter {
const unordered_set<Rune>& symbols_; const unordered_set<Rune>& symbols_;
}; // class PreFilter }; // class PreFilter
} // namespace CppJieba } // namespace cppjieba
#endif // CPPJIEBA_PRE_FILTER_H #endif // CPPJIEBA_PRE_FILTER_H

View File

@ -12,7 +12,7 @@
#include "TransCode.hpp" #include "TransCode.hpp"
#include "DictTrie.hpp" #include "DictTrie.hpp"
namespace CppJieba { namespace cppjieba {
class QuerySegment: public SegmentBase { class QuerySegment: public SegmentBase {
public: public:
QuerySegment(const string& dict, const string& model, const string& userDict = "", size_t maxWordLen = 4) QuerySegment(const string& dict, const string& model, const string& userDict = "", size_t maxWordLen = 4)

View File

@ -6,7 +6,7 @@
#include <cassert> #include <cassert>
namespace CppJieba { namespace cppjieba {
//const char* const SPECIAL_CHARS = " \t\n。"; //const char* const SPECIAL_CHARS = " \t\n。";
const Rune SPECIAL_SYMBOL[] = {32u, 9u, 10u, 65292u, 12290u}; const Rune SPECIAL_SYMBOL[] = {32u, 9u, 10u, 65292u, 12290u};
@ -32,6 +32,6 @@ class SegmentBase {
unordered_set<Rune> symbols_; unordered_set<Rune> symbols_;
}; // class SegmentBase }; // class SegmentBase
} // CppJieba } // cppjieba
#endif #endif

View File

@ -9,7 +9,7 @@
#include "limonp/StringUtil.hpp" #include "limonp/StringUtil.hpp"
#include "limonp/LocalVector.hpp" #include "limonp/LocalVector.hpp"
namespace CppJieba { namespace cppjieba {
using namespace limonp; using namespace limonp;
@ -65,6 +65,6 @@ inline void encode(const vector<Unicode>& input, vector<string>& output) {
} }
} // namespace TransCode } // namespace TransCode
} // namespace CppJieba } // namespace cppjieba
#endif #endif

View File

@ -5,7 +5,7 @@
#include <vector> #include <vector>
#include <queue> #include <queue>
namespace CppJieba { namespace cppjieba {
using namespace std; using namespace std;
const size_t MAX_WORD_LENGTH = 512; const size_t MAX_WORD_LENGTH = 512;

View File

@ -3,7 +3,7 @@
using namespace std; using namespace std;
int main(int argc, char** argv) { int main(int argc, char** argv) {
CppJieba::Jieba jieba("../dict/jieba.dict.utf8", cppjieba::Jieba jieba("../dict/jieba.dict.utf8",
"../dict/hmm_model.utf8", "../dict/hmm_model.utf8",
"../dict/user.dict.utf8"); "../dict/user.dict.utf8");
vector<string> words; vector<string> words;

View File

@ -7,7 +7,7 @@
#include "../src/KeywordExtractor.hpp" #include "../src/KeywordExtractor.hpp"
#include "../src/limonp/Colors.hpp" #include "../src/limonp/Colors.hpp"
using namespace CppJieba; using namespace cppjieba;
void cut(size_t times = 50) { void cut(size_t times = 50) {
MixSegment seg("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8"); MixSegment seg("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");

View File

@ -1,10 +1,10 @@
#include "src/Jieba.hpp" #include "src/Jieba.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
using namespace CppJieba; using namespace cppjieba;
TEST(JiebaTest, Test1) { TEST(JiebaTest, Test1) {
CppJieba::Jieba jieba("../dict/jieba.dict.utf8", cppjieba::Jieba jieba("../dict/jieba.dict.utf8",
"../dict/hmm_model.utf8", "../dict/hmm_model.utf8",
"../dict/user.dict.utf8"); "../dict/user.dict.utf8");
vector<string> words; vector<string> words;
@ -58,7 +58,7 @@ TEST(JiebaTest, Test1) {
} }
TEST(JiebaTest, InsertUserWord) { TEST(JiebaTest, InsertUserWord) {
CppJieba::Jieba jieba("../dict/jieba.dict.utf8", cppjieba::Jieba jieba("../dict/jieba.dict.utf8",
"../dict/hmm_model.utf8", "../dict/hmm_model.utf8",
"../dict/user.dict.utf8"); "../dict/user.dict.utf8");
vector<string> words; vector<string> words;

View File

@ -1,7 +1,7 @@
#include "src/KeywordExtractor.hpp" #include "src/KeywordExtractor.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
using namespace CppJieba; using namespace cppjieba;
TEST(KeywordExtractorTest, Test1) { TEST(KeywordExtractorTest, Test1) {
KeywordExtractor extractor("../test/testdata/extra_dict/jieba.dict.small.utf8", "../dict/hmm_model.utf8", "../dict/idf.utf8", "../dict/stop_words.utf8"); KeywordExtractor extractor("../test/testdata/extra_dict/jieba.dict.small.utf8", "../dict/hmm_model.utf8", "../dict/idf.utf8", "../dict/stop_words.utf8");

View File

@ -1,7 +1,7 @@
#include "src/PosTagger.hpp" #include "src/PosTagger.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
using namespace CppJieba; using namespace cppjieba;
static const char * const QUERY_TEST1 = "我是蓝翔技工拖拉机学院手扶拖拉机专业的。不用多久我就会升职加薪当上总经理出任CEO迎娶白富美走上人生巅峰。"; static const char * const QUERY_TEST1 = "我是蓝翔技工拖拉机学院手扶拖拉机专业的。不用多久我就会升职加薪当上总经理出任CEO迎娶白富美走上人生巅峰。";
static const char * const ANS_TEST1 = "[\"我:r\", \"是:v\", \"蓝翔:x\", \"技工:n\", \"拖拉机:n\", \"学院:n\", \"手扶拖拉机:n\", \"专业:n\", \"的:uj\", \"。:x\", \"不用:v\", \"多久:m\", \":x\", \"我:r\", \"就:d\", \"会:v\", \"升职:v\", \"加薪:nr\", \":x\", \"当上:t\", \"总经理:n\", \":x\", \"出任:v\", \"CEO:eng\", \":x\", \"迎娶:v\", \"白富:x\", \"美:ns\", \":x\", \"走上:v\", \"人生:n\", \"巅峰:n\", \"。:x\"]"; static const char * const ANS_TEST1 = "[\"我:r\", \"是:v\", \"蓝翔:x\", \"技工:n\", \"拖拉机:n\", \"学院:n\", \"手扶拖拉机:n\", \"专业:n\", \"的:uj\", \"。:x\", \"不用:v\", \"多久:m\", \":x\", \"我:r\", \"就:d\", \"会:v\", \"升职:v\", \"加薪:nr\", \":x\", \"当上:t\", \"总经理:n\", \":x\", \"出任:v\", \"CEO:eng\", \":x\", \"迎娶:v\", \"白富:x\", \"美:ns\", \":x\", \"走上:v\", \"人生:n\", \"巅峰:n\", \"。:x\"]";

View File

@ -1,7 +1,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "src/PreFilter.hpp" #include "src/PreFilter.hpp"
using namespace CppJieba; using namespace cppjieba;
TEST(PreFilterTest, Test1) { TEST(PreFilterTest, Test1) {
unordered_set<Rune> symbol; unordered_set<Rune> symbol;

View File

@ -7,7 +7,7 @@
#include "src/LevelSegment.hpp" #include "src/LevelSegment.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
using namespace CppJieba; using namespace cppjieba;
TEST(MixSegmentTest, Test1) { TEST(MixSegmentTest, Test1) {
MixSegment segment("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");; MixSegment segment("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");;

View File

@ -2,7 +2,7 @@
#include "src/MPSegment.hpp" #include "src/MPSegment.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
using namespace CppJieba; using namespace cppjieba;
static const char* const DICT_FILE = "../test/testdata/extra_dict/jieba.dict.small.utf8"; static const char* const DICT_FILE = "../test/testdata/extra_dict/jieba.dict.small.utf8";