BOOST
Boost是一個由C++社區開發的開源庫,為C++語言標準庫提供擴展。這個庫由C++標準委員會庫工作組成員發起,旨在提供大量功能和工具,幫助C++開發者更高效地編寫代碼。Boost庫強調跨平臺性和對標準C++的遵循,因此與編寫平臺無關,是C++標準化進程的重要開發引擎之一。
但是BOOST沒有站內的搜索引擎,我們在使用想快速查找信息的時候十分不方便,所以我們自己動手實現一個。
技術棧與項目環境
技術棧:
- 用C/C++作為主要編程語言,并利用STL中的容器等功能
- cpp-httplib:輕量級HTTP庫,用于構建HTTP服務器和處理HTTP請求
- cppjieba:中文分詞工具,用于對查詢詞和文檔進行分詞處理。
- HTML/CSS:用于前端開發,構建用戶搜索界面和展示搜索結果。
項目環境:
- CentOS7云服務器,作為項目的運行環境
- vim/gcc/g++/Makefile:代碼編輯、構建
搜索引擎的原理
正排索引(Forward Index)
正排索引是以文檔的ID為關鍵字,表中記錄文檔中每個詞的位置信息。
文檔ID | 文檔內容 |
---|---|
1 | 張三在吃飯 |
2 | 張三在買東西 |
索引的ID和文檔的內容是一一對應的,記錄了文檔中出現的關鍵詞及其出現次數和位置信息。正排索引的優勢在于可以快速地查找某個文檔里包含哪些詞項,但不適用于查找包含某個詞項的文檔有哪些。
倒排索引(Inverted Index)
倒排索引是以詞為關鍵字的索引結構,表中記錄了出現這個詞的所有文檔的ID和位置信息,或者記錄了這個詞在哪些文檔的哪些位置出現過,以及出現多少次。
關鍵字(具有唯一性) | 文檔ID,weight(權重) |
---|---|
張三 | 文檔1,文檔2 |
吃飯 | 文檔1 |
買東西 | 文檔2 |
查找過程: 用戶輸入張三-> 倒排索引->提取文檔ID(1,2)->根據正排索引->找到文檔的內容 ->title +conent(desc)+url 文檔結果進行摘要 ->構建響應結果
項目實現
數據部分
在boost官網把boost的內容下載下來,并在CentOS7下解壓。
創建一個data的目錄,把boost_1_83_0/doc/html/data拷貝到data目錄下的input中來,此時data/input就是我們的數據源。
去標簽與數據清洗Parser
上面說到的data/input數據源中我們隨便打開一個html文件
可以看到我們需要的是文檔中的內容,所以需要把標簽去掉,寫入到raw_html目錄中。
typedef struct DocInfo
{std::string title; // 文檔的標題std::string content; // 文檔的內容 --body里面有內容信息std::string url; // 該文檔在官網中的url
} DocInfo_t;int main()
{std::vector<std::string> files_list;// 1.遞歸式的把每個html文件命帶路徑,保存到files_list中// 方便后期進行一個一個文件的讀取if (!EnumFile(src_path, &files_list)){std::cerr << "euum file name error!" << std::endl;return 1;}// 2.按照files_list 讀取每個文件的內容,并進行解析std::vector<DocInfo_t> results; // 解析后的結果存放在results中if (!ParseHtml(files_list, &results)){std::cerr << "parse html error" << std::endl;return 2;}// 3.把解析完畢的各個文件內容,寫入到output中,按照\3作為分隔符if (!SaveHtml(results, output)){std::cerr << "sava html error" << std::endl;return 3;}return 0;
}
遍歷數據源下所有以 .html 擴展名的文件路徑,然后將這些路徑存儲在一個files_list中。
bool EnumFile(const std::string &src_path, std::vector<std::string> *files_list)
{namespace fs = boost::filesystem; // 給boost命名空間起別名fs::path root_path(src_path);if (!fs::exists(root_path)) // 路徑不存在直接退出{std::cerr << src_path << "not exists" << std::endl;return false;}// 定義一個迭代器來判斷遞歸的結束fs::recursive_directory_iterator end;// 遍歷文件路徑for (fs::recursive_directory_iterator iter(root_path); iter != end; iter++){// 判斷是不是普通文件if (!fs::is_regular_file(*iter)){continue;}// 判斷文件名的后綴是否符合要求if (iter->path().extension() != ".html"){continue;}files_list->push_back(iter->path().string()); // 把帶路徑的html保存在files_list中}return true;
}
從files_list的HTML文件列表中解析信息,提取titile、continue并構建URL到一個個DocInfo_t中。
bool ParseHtml(const std::vector<std::string> &files_list, std::vector<DocInfo_t> *results)
{for (const std::string &file : files_list){std::string result;// 讀文件if (!ns_util::FileUtil::ReadFile(file, &result)){continue;}DocInfo_t doc;// 解析文件,提取titleif (!ParseTitle(result, &doc.title)){continue;}// 解析文件,提取continue--去標簽if (!ParseContent(result, &doc.content)){continue;}// 解析文件路徑,構建urlif (!ParseUrl(file, &doc.url)){continue;}// 完成解析任務,解析結果保存在doc中results->push_back(std::move(doc)); // 減少拷貝}return true;
}//<title> 我們要的內容 <title>
static bool ParseTitle(const std::string &file, std::string *title)
{std::size_t begin = file.find("<title>");if (begin == std::string::npos){return false;}std::size_t end = file.find("</title>");if (end == std::string::npos){return false;}begin += std::string("<title>").size(); if (begin > end){return false; }*title = file.substr(begin, end - begin);return true;
}/*<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>*/
//上面的標簽都清洗掉
/*<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="array.ack"></a>Acknowledgements</h2></div></div></div>
<p>Doug Gregor </p>*/
//標簽中的Acknowledgements 、Doug Gregor保留下來
static bool ParseContent(const std::string &file, std::string *content)
{//狀態機enum status{LABLE,CONTENT};enum status s = LABLE; // 默認為LABLE狀態for (char c : file) //以字符方式遍歷file{switch (s){case LABLE:if (c == '>') // 碰到>就意味著標簽處理完畢s = CONTENT;break;case CONTENT:if (c == '<') //碰到<就意味著內容處理完畢s = LABLE;else{// 不保留原始文件的\n, \n用來做html解析之后的文本分割符if (c == '\n')c = ' ';content->push_back(c);}break;default:break;}}return true;
}/*
boost庫的官方文檔和下載下來的文檔是有路徑對應關系的
//官網URL
https://www.boost.org/doc/libs/1_83_0/doc/html/accumulators.html
//linux中URL
data/input/accumulators.html//下載下來的boost庫url_head ="https://boost.org/doc/libs/1_83_0/doc/html/"
url_tail= data/input/accumulators.html data/input(刪除)--> /accumulators.html
url = url_head + url_tail //相當于一個官網連接 */static bool ParseUrl(const std::string &file_path, std::string *url)
{std::string url_head = "https://www.boost.org/doc/libs/1_83_0/doc/html";std::string url_tail = file_path.substr(src_path.size()); //subsrt去掉data/input*url = url_head + url_tail;return true;
}
將一組DocInfo_t類型的數據也就是上面解析出來的內容保存到output中。
#define SEP '\3' //分割符號
bool SaveHtml(const std::vector<DocInfo_t> &results, const std::string &output)
{// 二進制寫入--寫入什么文檔保存就是什么std::ofstream out(output, std::ios::out | std::ios::binary); if (!out.is_open()){std::cerr << "open " << output << "failed" << std::endl;return false;}//title\3content\3url \n title\3content\3url \n ....//方便getline(ifsream,line)直接獲取文檔全部內容 title\3content\3url(getline以\n結束) for (auto &item : results){std::string out_string;out_string = item.title;out_string += SEP;out_string += item.content;out_string += SEP;out_string += item.url;out_string += '\n'; // 文檔和文檔之間的分隔out.write(out_string.c_str(), out_string.size());}out.close();return true;
}
索引Index
對清洗過的內容構建正排、倒排索引
struct DocInfo
{ std::string title; //文檔的標題std::string content; //文檔對應的去標簽之后的內容std::string url; //官網文檔urluint64_t doc_id; //文檔的ID,用uint64_t:為了防止索引越界
};//倒排結構
struct InvertedElem
{ uint64_t doc_id;//對應的文檔idstd::string word;//關鍵字int weight; //權重 可以根據權重決定文檔顯示的先后順序InvertedElem():weight(0){}
};typedef std::vector<InvertedElem> InvertedList;// 倒排拉鏈
//單例模式
class Index
{
private:std::vector<DocInfo> forward_index;// 正排拉鏈//存放關鍵字和倒排拉鏈的映射關系std::unordered_map<std::string, InvertedList> inverted_index;
public:Index(){} //但是一定要有函數體,不能delete~Index(){}Index(const Index&) = delete;Index& operator=(const Index&) = delete;static Index* instance;//指向全局唯一的單例對象static std::mutex mtx;
public://獲取全局唯一的單例對象static Index* GetInstance(){//第一次需要加鎖,后面都不需要加鎖的場景,可以使用雙檢查加鎖//特點:第一次加鎖,后面不加鎖,保護線程安全,同時提高效率if(nullptr == instance){//加鎖只有第一次有意義,后面再有線程來沒必要加鎖,加鎖會引發效率低下mtx.lock();if(nullptr == instance){instance = new Index();}mtx.unlock();}return instance;//返回這個全局的單例對象}//根據文檔id找到找到文檔內容 DocInfo* GetForwardIndex(uint64_t doc_id) { if(doc_id >= forward_index.size()) //沒有該文檔id{std::cerr << "doc_id out range, error!" << std::endl;return nullptr;}return &forward_index[doc_id]; //數組的下標天然就是文檔id,所以直接返回數組對應的內容的地址}//根據關鍵字word,獲得倒排拉鏈 InvertedList *GetInvertedList(const std::string &word){//在哈希表當中查找是否存在這個關鍵字對應的倒排拉鏈auto iter = inverted_index.find(word);if(iter == inverted_index.end()){std::cerr << word << " have no InvertedList" << std::endl;return nullptr;}return &(iter->second);}//根據文檔內容構造索引,參數:經過數據清洗之后的文檔bool BuildIndex(const std::string &input) {std::ifstream in(input, std::ios::in | std::ios::binary);if(!in.is_open()){ std::cerr << "build index error, open " << input << " failed" << std::endl;return false;}int count = 0;//方便觀察當前建立的索引個數std::string line; //讀取一行數據 //對每一個html文件格式化之后的內容進行正排和倒排索引while(std::getline(in, line)) {//建立正排索引,返回描述這個文檔內容的節點DocInfo * doc = BuildForwardIndex(line); if(nullptr == doc){ std::cerr << "build " << line << " error" << std::endl; //for deubgcontinue;}BuildInvertedIndex(*doc);//根據上面返回的正排索引節點,建立倒排索引count ++;if(count % 150 == 0){LOG(NORMAL,"當前的已經建立的索引文檔:"+std::to_string(count));}}return true;}
};
建立正排索引
//line:就是一個html文件里面去標簽,格式化之后的文檔內容DocInfo *BuildForwardIndex(const std::string &line) {//1. 解析line->本質是進行字符串切分,解析成:title, content, url std::vector<std::string> results;//保存切分好的內容const std::string sep = "\3"; //分隔符//切分字符串ns_util::StringUtil::Split(line, &results, sep);if(results.size() != 3) //判斷切分結果是否正確,要切分為3部分{ return nullptr;}//2. 切分好的字符串進行填充到DocIinfoDocInfo doc;doc.title = results[0]; //titledoc.content = results[1]; //contentdoc.url = results[2]; ///urldoc.doc_id = forward_index.size(); //3. 插入到正排索引數組當中forward_index.push_back(std::move(doc)); return &forward_index.back(); }
建立倒排索引
bool BuildInvertedIndex(const DocInfo &doc)//建立倒排索引,參數是正排索引節點{//DocInfo里面包含一個html文件的:{title, content, url, doc_id}struct word_cnt //針對一個詞的數據統計{ int title_cnt;//在標題出現次數int content_cnt;//在內容中出現次數word_cnt():title_cnt(0), content_cnt(0){} };std::unordered_map<std::string, word_cnt> word_map; //暫存詞頻的映射表/* 根據文檔標題和內容,分詞并進行詞頻統計 *///對標題進行分詞std::vector<std::string> title_words;ns_util::JiebaUtil::CutString(doc.title, &title_words);//對標題分詞之后的結果進行詞頻統計for(std::string s : title_words){ boost::to_lower(s); //忽略大小寫//查找對應關鍵詞,如果存在就++,不存在就新建 word_map[s].title_cnt++; }//對內容進行分詞std::vector<std::string> content_words;ns_util::JiebaUtil::CutString(doc.content, &content_words);//對內容進行詞頻統計for(std::string s : content_words) {boost::to_lower(s);//忽略大小寫word_map[s].content_cnt++;}// 自定義相關性#define X 15 //標題當中出現的詞,權重更高#define Y 1//建立倒排拉鏈for(auto &word_pair : word_map){InvertedElem item;item.doc_id = doc.doc_id;item.word = word_pair.first;//設置權重item.weight = X*word_pair.second.title_cnt +Y*word_pair.second.content_cnt; InvertedList& inverted_list = inverted_index[word_pair.first];inverted_list.push_back(std::move(item));}return true;}
搜索服務Searcher
前面的部分都是前期的準備工作,Searcher提供搜索服務,對用戶輸入的字符串進行分詞,使用倒排索引查找與查詢詞相關的內容,并進行排序。
namespace ns_searcher
{struct InvertedElemPrint{uint64_t doc_id; // 文檔idint weight; // 累加權重std::vector<std::string> words; // 一個doc_id對應多個關鍵字InvertedElemPrint() : doc_id(0), weight(0){}};class Searcher{private:ns_index::Index *index; // 供系統進行查找的索引public:Searcher() {}~Searcher() {}void InitSearcher(const std::string &input){// 1. 獲取或者創建index對象index = ns_index::Index::GetInstance();LOG(NORMAL, "獲取index單例成功");// 2. 根據index對象建立索引index->BuildIndex(input);LOG(NORMAL, "建立正排和倒排索引成功...");}// 獲取一部分內容std::string GetDesc(const std::string &html_content, const std::string &word){// 1.在html_content范圍內,找word首次出現的位置auto cmp = [](char x, char y) { return (std::tolower(static_cast<unsigned char>(x)) == std::tolower(static_cast<unsigned char>(y))); }; auto iter = std::search(html_content.begin(), html_content.end(), word.begin(), word.end(), cmp); if (iter == html_content.end()){return "None1";}int pos = iter - html_content.begin();// 2. 獲取start,end的位置int start = 0; // 默認就是在文本的起始位置int end = html_content.size() - 1; // 默認是文本的結尾// 找到word在html_content中的首次出現的位置,然后往前找30字節,如果沒有,就從 start開始// 往后找80字節如果沒有,到end就可以的 ,然后截取出這部分內容const int prev_step = 30;const int next_step = 80;if (pos - prev_step > 0)start = pos - prev_step;if (pos + next_step < end)end = pos + next_step;// 3. 截取子串,然后returnif (start >= end)return "None2";// 從start開始,截取end - start個字節的內容std::string desc = html_content.substr(start, end - start);desc += "...";return desc;}// query:用戶搜索關鍵字 json_string: 返回給用戶瀏覽器的搜索結果void Search(const std::string &query, std::string *json_string){// 1.對query進行按照searcher的要求進行分詞std::vector<std::string> words;ns_util::JiebaUtil::CutString(query, &words);// 2.就是根據分詞的各個"詞",進行index索引查找std::vector<InvertedElemPrint> inverted_list_all; // 存放所有經過去重之后的倒排拉鏈// 根據doc_id進行去重,凡是id相同的倒排索引節點,其關鍵字都放在InvertedElemPrint的vector里面std::unordered_map<uint64_t, InvertedElemPrint> tokens_map;// 因為我們建立索引的時候,建立index是忽略大小寫,所以搜索的時候關鍵字也需要忽略大小寫for (std::string word : words){boost::to_lower(word); // 將切分之后的查找關鍵字轉為小寫// 先查倒排ns_index::InvertedList *inverted_list = index->GetInvertedList(word); // 通過關鍵字獲得倒排拉鏈if (nullptr == inverted_list) {continue; // 檢測下一個關鍵詞}for (const auto &elem : *inverted_list) // 遍歷倒排拉鏈,合并索引節點{//[]:如果存在直接獲取,如果不存在新建auto &item = tokens_map[elem.doc_id]; // 根據文檔id獲得其對應的關鍵字集合// 此時item一定是doc_id相同的倒排拉鏈打印節點item.doc_id = elem.doc_id;item.weight += elem.weight; // 權值累加item.words.push_back(elem.word); // 把當前的關鍵字放到去重的倒排拉鏈打印節點當中的vector當中保存}}for (const auto &item : tokens_map) // 遍歷去重之后的map{inverted_list_all.push_back(std::move(item.second)); // 插入倒排拉鏈打印節點到inverted_list_all}// 3.匯總查找結果,按照相關性(weight)進行降序排序auto cmp = [](const InvertedElemPrint &e1, const InvertedElemPrint &e2){return e1.weight > e2.weight;};std::sort(inverted_list_all.begin(), inverted_list_all.end(), cmp);// 4.根據查找出來的結果,構建json串 -- jsoncpp --通過jsoncpp完成序列化&&反序列化Json::Value root;for (auto &item : inverted_list_all){// item就是倒排索引打印節點ns_index::DocInfo *doc = index->GetForwardIndex(item.doc_id); // 根據文檔id->查詢正排,返回正排索引節點if (nullptr == doc){continue;}// doc里面就有title,url,content,文檔id// 我們想給瀏覽器返回的是網頁的title,內容摘要,鏈接Json::Value elem;elem["title"] = doc->title;//只需要一部分文檔內容elem["desc"] = GetDesc(doc->content, item.words[0]);elem["url"] = doc->url;// for deubg, for deleteelem["id"] = (int)item.doc_id; // doc_id是uint64 ,json可能報錯,所以轉為intelem["weight"] = item.weight; // doc_id,weight雖然是int,但是json會幫我們自動轉為stringroot.append(elem);}// Json::StyledWriter writer; //為了方便調試觀看Json::FastWriter writer;*json_string = writer.write(root);}};
}
http_server
監聽HTTP請求,解析用戶輸入的參數,調用Searcher進行搜索,把給結果響應回給客戶。
#include "cpp-httplib/httplib.h"
#include "searcher.hpp"//引入搜索引擎
const std::string input = "data/raw_html/raw.txt";//html文件經過parser之后存放的結果的路徑
const std::string root_path = "./wwwroot"; //wwroot作為服務器的主頁int main()
{ns_searcher::Searcher search;search.InitSearcher(input);httplib::Server svr;svr.set_base_dir(root_path.c_str());svr.Get("/s", [&search](const httplib::Request &req, httplib::Response &rsp) {if (!req.has_param("word")){rsp.set_content("必須要有搜索關鍵字!", "text/plain; charset=utf-8");return;}std::string word = req.get_param_value("word");LOG(NORMAL,"用戶在搜索:"+word);std::string json_string;search.Search(word, &json_string);//返回給客戶端rsp.set_content(json_string, "application/json"); });LOG(NORMAL,"服務器啟動成功...");svr.listen("0.0.0.0", 8081);return 0;
}
工具util
//文件讀取
class FileUtil{public:static bool ReadFile(const std::string &file_path, std::string *out){std::ifstream in(file_path, std::ios::in); // 讀文件if (!in.is_open()){std::cerr << "open file" << file_path << "error" << std::endl;return false;}std::string line;// 為什么getline的返回值是流的引用&,while是bool,能進行判斷呢?// 重載了強制類型轉換while (std::getline(in, line)){*out += line;}in.close();return true;}};// 字符串切割class StringUtil{public:static void Split(const std::string &target, std::vector<std::string> *out, std::string sep){// token_compress_on on:壓縮打開 --將所有相連的分隔符壓縮成一個 aa\3\3\3\3\3bbb-->aa bbb// off:壓縮關閉boost::split(*out, target, boost::is_any_of(sep), boost::token_compress_on);}};//Jieba分詞
// dict路徑const char *const DICT_PATH = "./dict/jieba.dict.utf8";const char *const HMM_PATH = "./dict/hmm_model.utf8";const char *const USER_DICT_PATH = "./dict/user.dict.utf8";const char *const IDF_PATH = "./dict/idf.utf8";const char *const STOP_WORD_PATH = "./dict/stop_words.utf8";class JiebaUtil{private:// static cppjieba::Jieba jieba;cppjieba::Jieba jieba;std::unordered_map<std::string, bool> stop_words;private:JiebaUtil() : jieba(DICT_PATH, HMM_PATH, USER_DICT_PATH, IDF_PATH, STOP_WORD_PATH){}JiebaUtil(const JiebaUtil &) = delete;static JiebaUtil *instance;public:static JiebaUtil *get_instance(){static std::mutex mtx;if (nullptr == instance){mtx.lock();if (nullptr == instance){instance = new JiebaUtil();instance->InitJiebaUtil();}mtx.unlock();}return instance;}// 把暫停詞加載進來void InitJiebaUtil(){std::ifstream in(STOP_WORD_PATH);if (!in.is_open()){LOG(FATAL, "load stop words file error");return;}std::string line;while (std::getline(in, line)){stop_words.insert({line, true});}in.close();}
/*去掉暫停詞暫停詞是對我們搜索沒意義的詞語,如:“的”、“地”、“吧”等*/void CutStringHelper(const std::string &src, std::vector<std::string> *out){jieba.CutForSearch(src, *out);for (auto iter = out->begin(); iter != out->end();){auto it = stop_words.find(*iter);if (it != stop_words.end()){ // 說明當前的string 是暫停詞,需要去掉iter = out->erase(iter);}else{iter++;}}}public:static void CutString(const std::string &src, std::vector<std::string> *out){ns_util::JiebaUtil::get_instance()->CutStringHelper(src, out);// jieba.CutForSearch(src,*out);}};
log
#pragma once
#include<iostream>
#include<string>
#include<ctime>
#define NORMAL 1
#define WARNING 2
#define DEBUG 3
#define FATAL 4
#define LOG(LEVEL,MESSAGE) log(#LEVEL,MESSAGE,__FILE__,__LINE__)void log(std::string level,std::string message,std::string file,int line)
{std::cout<<"["<<level<<"]"<<time(nullptr)<<"["<<message<<"]"<<"["<<file<<":"<<line<<"]"<<std::endl;
}
編寫js
用原生js成本高,jQuery好
<script>function Search(){// 是瀏覽器的一個彈出框//alert("hello js!");// 1. 提取數據, $可以理解成就是JQuery的別稱let query = $(".container .search input").val();console.log("query = " + query); //console是瀏覽器的對話框,可以用來進行查看js數據//2. 發起http請求,ajax: 屬于一個和后端進行數據交互的函數,JQuery中的$.ajax({type: "GET",url: "/s?word=" + query,success: function(data){console.log(data);BuildHtml(data);}});}function BuildHtml(data){// if(data==''||data==ull)// {// document.write("搜索不到");// return;// }// 獲取html中的result標簽let result_lable = $(".container .result");// 清空歷史搜索結果result_lable.empty();for( let elem of data){ let a_lable = $("<a>", {text: elem.title,href: elem.url,// 跳轉到新的頁面target: "_blank"});let p_lable = $("<p>", {text: elem.desc});let i_lable = $("<i>", {text: elem.url});let div_lable = $("<div>", {class: "item"});a_lable.appendTo(div_lable);p_lable.appendTo(div_lable);i_lable.appendTo(div_lable);div_lable.appenesult_lable);}}</script>
項目擴展
- 建立整個站的搜索,把boost庫的各個版本都進行正排倒排建立索引
- 數據部分設計一個在線更新網頁內容,利用爬蟲,信號等進行設計
- 添加整站搜索、競價排名、熱詞統計等,進一步豐富項目的功能和用戶體驗。
- 設計登錄注冊功能,引入mysql
遇到問題
1.存在搜索出相同的內容的問題
解決:在searcher模塊用unordered_map對建立的倒排拉鏈進行去重。
2.查看權重值的時候發現對不上
原因:分詞的時候會出現包含單詞也會統計的情況,比如我搜sprlit,sprlitabc也會被搜到。
3.使用jieba庫的時候出現找不到Log的錯誤
jieba的include下的頭文件有方法,jieba/dict里有分詞的庫(具體怎么分詞),我們采取鏈接的方式,jieba有一個問題就是需要把deps/limonp拷貝到include/cppjieba下,不然會報錯找不到log