Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

出现按字分词bug #191

Open
yourbikun opened this issue Dec 17, 2024 · 1 comment
Open

出现按字分词bug #191

yourbikun opened this issue Dec 17, 2024 · 1 comment

Comments

@yourbikun
Copy link

能帮我解决下吗
执行结果为
他来到了网易杭研大厦
他/来/到/了/网/易/杭/研/大/厦

我的代码为:
#include "Jieba.hpp"

using namespace std;
const char* const DICT_PATH = "C:\Users\ins\Desktop\DLP\3rdparty\dict/jieba.dict.utf8";
const char* const HMM_PATH = "C:\Users\ins\Desktop\DLP\3rdparty\dict/hmm_model.utf8";
const char* const USER_DICT_PATH = "C:\Users\ins\Desktop\DLP\3rdparty\dict/user.dict.utf8";
const char* const IDF_PATH = "C:\Users\ins\Desktop\DLP\3rdparty\dict/idf.utf8";
const char* const STOP_WORD_PATH = "C:\Users\ins\Desktop\DLP\3rdparty\dict/stop_words.utf8";

int main(int argc, char** argv) {
cppjieba::Jieba jieba(DICT_PATH, HMM_PATH, USER_DICT_PATH, IDF_PATH, STOP_WORD_PATH);
string text = "他来到了网易杭研大厦";

std::vector<std::string> words;
jieba.Cut(text, words, false);  // 这里直接获取分词结果到vector
cout << text << endl;
cout << limonp::Join(words.begin(), words.end(), "/") << endl;

return 0;

}

@yourbikun
Copy link
Author

运行在windows上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant