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

add check of input to avoid coredump #117

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/cppjieba/Jieba.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,48 @@ class Jieba {
}; // struct LocWord

void Cut(const string& sentence, vector<string>& words, bool hmm = true) const {
if(sentence.empty()) return;
mix_seg_.Cut(sentence, words, hmm);
}
void Cut(const string& sentence, vector<Word>& words, bool hmm = true) const {
if(sentence.empty()) return;
mix_seg_.Cut(sentence, words, hmm);
}
void CutAll(const string& sentence, vector<string>& words) const {
if(sentence.empty()) return;
full_seg_.Cut(sentence, words);
}
void CutAll(const string& sentence, vector<Word>& words) const {
if(sentence.empty()) return;
full_seg_.Cut(sentence, words);
}
void CutForSearch(const string& sentence, vector<string>& words, bool hmm = true) const {
if(sentence.empty()) return;
query_seg_.Cut(sentence, words, hmm);
}
void CutForSearch(const string& sentence, vector<Word>& words, bool hmm = true) const {
if(sentence.empty()) return;
query_seg_.Cut(sentence, words, hmm);
}
void CutHMM(const string& sentence, vector<string>& words) const {
if(sentence.empty()) return;
hmm_seg_.Cut(sentence, words);
}
void CutHMM(const string& sentence, vector<Word>& words) const {
if(sentence.empty()) return;
hmm_seg_.Cut(sentence, words);
}
void CutSmall(const string& sentence, vector<string>& words, size_t max_word_len) const {
if(sentence.empty()) return;
mp_seg_.Cut(sentence, words, max_word_len);
}
void CutSmall(const string& sentence, vector<Word>& words, size_t max_word_len) const {
if(sentence.empty()) return;
mp_seg_.Cut(sentence, words, max_word_len);
}

void Tag(const string& sentence, vector<pair<string, string> >& words) const {
if(sentence.empty()) return;
mix_seg_.Tag(sentence, words);
}
string LookupTag(const string &str) const {
Expand Down