本文整理汇总了C++中Sentence::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Sentence::begin方法的具体用法?C++ Sentence::begin怎么用?C++ Sentence::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentence
的用法示例。
在下文中一共展示了Sentence::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assign
bool Lattice::assign(utils::piece::const_iterator& iter, utils::piece::const_iterator end)
{
namespace qi = boost::spirit::qi;
namespace standard = boost::spirit::standard;
clear();
// empty lattice...
if (iter == end) return true;
utils::piece::const_iterator iter_back = iter;
if (qi::phrase_parse(iter, end, lattice_grammar_parser_impl::instance(), standard::space, lattice)) {
initialize_distance();
return true;
} else {
clear();
// fallback to sentence...
iter = iter_back;
Sentence sentence;
if (sentence.assign(iter, end)) {
Sentence::const_iterator iter_end = sentence.end();
for (Sentence::const_iterator iter = sentence.begin(); iter != iter_end; ++ iter)
lattice.push_back(arc_set_type(1, arc_type(*iter)));
return true;
} else {
clear();
return false;
}
}
}
示例2: makeNGram
// make N-gram
Sentence makeNGram(const Sentence& sent, Position begin, unsigned int n)
{
Sentence ret;
auto it1 = sent.begin() + begin;
auto it2 = it1 + n;
ret.insert(ret.end(), it1, it2);
return move(ret);
}
示例3: putSentence
// render a sentence in words
void putSentence(const Wordlist& wlist, const Sentence sent)
{
for (Sentence::const_iterator i = sent.begin() ; i != sent.end() ; ++i) {
if (*i != 0)
cout << wlist[*i-1] << " " ;
}
cout << endl ;
}