本文整理汇总了C++中WERD_CHOICE::unicharset方法的典型用法代码示例。如果您正苦于以下问题:C++ WERD_CHOICE::unicharset方法的具体用法?C++ WERD_CHOICE::unicharset怎么用?C++ WERD_CHOICE::unicharset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WERD_CHOICE
的用法示例。
在下文中一共展示了WERD_CHOICE::unicharset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EqualIgnoringCaseAndTerminalPunct
bool EqualIgnoringCaseAndTerminalPunct(const WERD_CHOICE &word1,
const WERD_CHOICE &word2) {
const UNICHARSET *uchset = word1.unicharset();
if (word2.unicharset() != uchset) return false;
int w1start, w1end;
word1.punct_stripped(&w1start, &w1end);
int w2start, w2end;
word2.punct_stripped(&w2start, &w2end);
if (w1end - w1start != w2end - w2start) return false;
for (int i = 0; i < w1end - w1start; i++) {
if (uchset->to_lower(word1.unichar_id(w1start + i)) !=
uchset->to_lower(word2.unichar_id(w2start + i))) {
return false;
}
}
return true;
}
示例2: count_alphas
inT16 Tesseract::count_alphas(const WERD_CHOICE &word) {
int count = 0;
for (int i = 0; i < word.length(); ++i) {
if (word.unicharset()->get_isalpha(word.unichar_id(i)))
count++;
}
return count;
}
示例3: set_hyphen_word
// Update hyphen_word_, and copy the given DawgPositionVectors into
// hyphen_active_dawgs_.
void Dict::set_hyphen_word(const WERD_CHOICE &word,
const DawgPositionVector &active_dawgs) {
if (hyphen_word_ == NULL) {
hyphen_word_ = new WERD_CHOICE(word.unicharset());
hyphen_word_->make_bad();
}
if (hyphen_word_->rating() > word.rating()) {
*hyphen_word_ = word;
// Remove the last unichar id as it is a hyphen, and remove
// any unichar_string/lengths that are present.
hyphen_word_->remove_last_unichar_id();
hyphen_active_dawgs_ = active_dawgs;
}
if (hyphen_debug_level) {
hyphen_word_->print("set_hyphen_word: ");
}
}