mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
[code style] lower case namespace
This commit is contained in:
parent
16b69e35c1
commit
ecacf118e6
@ -4,6 +4,7 @@
|
||||
|
||||
1. 支持多个userdict载入,多词典路径用英文冒号(:)作为分隔符,就当是向环境变量PATH致敬,哈哈。
|
||||
2. userdict是不带权重的,之前对于新的userword默认设置词频权重为最大值,现已支持可配置,默认使用中位值。
|
||||
3. 修改一些代码风格,比如命名空间小写化,从CppJieba变成cppjieba。
|
||||
|
||||
## v3.2.1
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include "Jieba.hpp"
|
||||
|
||||
using namespace husky;
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
class ReqHandler: public IRequestHandler {
|
||||
public:
|
||||
ReqHandler(const CppJieba::Jieba& jieba)
|
||||
ReqHandler(const cppjieba::Jieba& jieba)
|
||||
: jieba_(jieba) {
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ class ReqHandler: public IRequestHandler {
|
||||
}
|
||||
}
|
||||
private:
|
||||
const CppJieba::Jieba& jieba_;
|
||||
const cppjieba::Jieba& jieba_;
|
||||
};
|
||||
|
||||
bool Run(int argc, char** argv) {
|
||||
@ -83,7 +83,7 @@ bool Run(int argc, char** argv) {
|
||||
|
||||
LogInfo("config info: %s", conf.getConfigInfo().c_str());
|
||||
|
||||
CppJieba::Jieba jieba(dictPath,
|
||||
cppjieba::Jieba jieba(dictPath,
|
||||
modelPath,
|
||||
userDictPath);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "TransCode.hpp"
|
||||
#include "Trie.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
using namespace limonp;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "SegmentBase.hpp"
|
||||
#include "TransCode.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
class FullSegment: public SegmentBase {
|
||||
public:
|
||||
FullSegment(const string& dictPath) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "limonp/StringUtil.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
using namespace limonp;
|
||||
typedef unordered_map<uint16_t, double> EmitProbMap;
|
||||
@ -137,6 +137,6 @@ struct HMMModel {
|
||||
vector<EmitProbMap* > emitProbVec;
|
||||
}; // struct HMMModel
|
||||
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "HMMModel.hpp"
|
||||
#include "SegmentBase.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
class HMMSegment: public SegmentBase {
|
||||
public:
|
||||
HMMSegment(const string& filePath) {
|
||||
@ -175,6 +175,6 @@ class HMMSegment: public SegmentBase {
|
||||
bool isNeedDestroy_;
|
||||
}; // class HMMSegment
|
||||
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "PosTagger.hpp"
|
||||
#include "LevelSegment.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
class Jieba {
|
||||
public:
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <cmath>
|
||||
#include <set>
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
using namespace limonp;
|
||||
|
||||
/*utf8*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "MPSegment.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
class LevelSegment: public SegmentBase{
|
||||
public:
|
||||
@ -77,6 +77,6 @@ class LevelSegment: public SegmentBase{
|
||||
MPSegment mpSeg_;
|
||||
}; // class LevelSegment
|
||||
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif // CPPJIEBA_LEVELSEGMENT_H
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "DictTrie.hpp"
|
||||
#include "SegmentBase.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
class MPSegment: public SegmentBase {
|
||||
public:
|
||||
@ -109,6 +109,6 @@ class MPSegment: public SegmentBase {
|
||||
bool isNeedDestroy_;
|
||||
}; // class MPSegment
|
||||
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "HMMSegment.hpp"
|
||||
#include "limonp/StringUtil.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
class MixSegment: public SegmentBase {
|
||||
public:
|
||||
MixSegment(const string& mpSegDict, const string& hmmSegDict,
|
||||
@ -86,6 +86,6 @@ class MixSegment: public SegmentBase {
|
||||
|
||||
}; // class MixSegment
|
||||
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "limonp/StringUtil.hpp"
|
||||
#include "DictTrie.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
using namespace limonp;
|
||||
|
||||
static const char* const POS_M = "m";
|
||||
@ -74,6 +74,6 @@ class PosTagger {
|
||||
MixSegment segment_;
|
||||
}; // class PosTagger
|
||||
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "TransCode.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
//class PreFilterIterator {
|
||||
// public:
|
||||
@ -56,6 +56,6 @@ class PreFilter {
|
||||
const unordered_set<Rune>& symbols_;
|
||||
}; // class PreFilter
|
||||
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif // CPPJIEBA_PRE_FILTER_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "TransCode.hpp"
|
||||
#include "DictTrie.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
class QuerySegment: public SegmentBase {
|
||||
public:
|
||||
QuerySegment(const string& dict, const string& model, const string& userDict = "", size_t maxWordLen = 4)
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <cassert>
|
||||
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
//const char* const SPECIAL_CHARS = " \t\n,。";
|
||||
const Rune SPECIAL_SYMBOL[] = {32u, 9u, 10u, 65292u, 12290u};
|
||||
@ -32,6 +32,6 @@ class SegmentBase {
|
||||
unordered_set<Rune> symbols_;
|
||||
}; // class SegmentBase
|
||||
|
||||
} // CppJieba
|
||||
} // cppjieba
|
||||
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "limonp/StringUtil.hpp"
|
||||
#include "limonp/LocalVector.hpp"
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
|
||||
using namespace limonp;
|
||||
|
||||
@ -65,6 +65,6 @@ inline void encode(const vector<Unicode>& input, vector<string>& output) {
|
||||
}
|
||||
|
||||
} // namespace TransCode
|
||||
} // namespace CppJieba
|
||||
} // namespace cppjieba
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
|
||||
namespace CppJieba {
|
||||
namespace cppjieba {
|
||||
using namespace std;
|
||||
|
||||
const size_t MAX_WORD_LENGTH = 512;
|
||||
|
@ -3,7 +3,7 @@
|
||||
using namespace std;
|
||||
|
||||
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/user.dict.utf8");
|
||||
vector<string> words;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "../src/KeywordExtractor.hpp"
|
||||
#include "../src/limonp/Colors.hpp"
|
||||
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
void cut(size_t times = 50) {
|
||||
MixSegment seg("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "src/Jieba.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
TEST(JiebaTest, Test1) {
|
||||
CppJieba::Jieba jieba("../dict/jieba.dict.utf8",
|
||||
cppjieba::Jieba jieba("../dict/jieba.dict.utf8",
|
||||
"../dict/hmm_model.utf8",
|
||||
"../dict/user.dict.utf8");
|
||||
vector<string> words;
|
||||
@ -58,7 +58,7 @@ TEST(JiebaTest, Test1) {
|
||||
}
|
||||
|
||||
TEST(JiebaTest, InsertUserWord) {
|
||||
CppJieba::Jieba jieba("../dict/jieba.dict.utf8",
|
||||
cppjieba::Jieba jieba("../dict/jieba.dict.utf8",
|
||||
"../dict/hmm_model.utf8",
|
||||
"../dict/user.dict.utf8");
|
||||
vector<string> words;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "src/KeywordExtractor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
TEST(KeywordExtractorTest, Test1) {
|
||||
KeywordExtractor extractor("../test/testdata/extra_dict/jieba.dict.small.utf8", "../dict/hmm_model.utf8", "../dict/idf.utf8", "../dict/stop_words.utf8");
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "src/PosTagger.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
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\"]";
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/PreFilter.hpp"
|
||||
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
TEST(PreFilterTest, Test1) {
|
||||
unordered_set<Rune> symbol;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "src/LevelSegment.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
TEST(MixSegmentTest, Test1) {
|
||||
MixSegment segment("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "src/MPSegment.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace CppJieba;
|
||||
using namespace cppjieba;
|
||||
|
||||
static const char* const DICT_FILE = "../test/testdata/extra_dict/jieba.dict.small.utf8";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user