本文整理汇总了C++中Chart::access方法的典型用法代码示例。如果您正苦于以下问题:C++ Chart::access方法的具体用法?C++ Chart::access怎么用?C++ Chart::access使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chart
的用法示例。
在下文中一共展示了Chart::access方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_internal_rules
void ParserCKYBest::process_internal_rules(Chart& chart) const
{
unsigned sent_size=chart.get_size();
for (unsigned span = 2; span <= sent_size; ++span) {
unsigned end_of_begin=sent_size-span;
for (unsigned begin=0; begin <= end_of_begin; ++begin) {
unsigned end = begin + span -1;
// std::cout << "begin: " << begin << ", end: " << end << std::endl;
Cell& result_cell = chart.access(begin,end);
if(!result_cell.is_closed()) {
// look for all possible new edges
for (unsigned m = begin; m < end; ++m) {
const Cell& left_cell = chart.access(begin,m);
if(!left_cell.is_closed()) {
const Cell& right_cell = chart.access(m+1,end);
if( !right_cell.is_closed())
get_candidates(left_cell,right_cell,result_cell);
}
}
// std::cout << result_cell << std::endl;
add_unary(result_cell, span == sent_size);
// result_cell.apply_beam();
}
// std::cout << result_cell << std::endl;
}
}
}
示例2: parse
void ParserCKYBest::parse(Chart& chart) const
{
bool isroot = chart.get_size() == 1;
for(unsigned i = 0; i < chart.get_size(); ++i) {
// std::cout << "initialising position: " << i << std::endl;
add_unary_init(chart.access(i,i),isroot);
// std::cout << chart.access(i,i) << std::endl;
}
process_internal_rules(chart);
}