本文整理汇总了C++中mrs_string::end方法的典型用法代码示例。如果您正苦于以下问题:C++ mrs_string::end方法的具体用法?C++ mrs_string::end怎么用?C++ mrs_string::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mrs_string
的用法示例。
在下文中一共展示了mrs_string::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: f
bool
TimeLine::load(mrs_string filename, mrs_string lexicon_labels)
{
ifstream in;
filename_ = filename;
if(filename == "")
return false;
in.open(filename.c_str());
if(!in.is_open())
{
MRSWARN("TimeLine::load() - Problem opening file " << filename_);
return false;
}
FileName f(filename);
vector<mrs_string> labels;
// Load lexicon dictionary if available
mrs_string lexicon_label;
mrs_string remainder;
size_t nLabels;
nLabels = std::count(lexicon_labels.begin(), lexicon_labels.end(), ',');
if (lexicon_labels != ",")
{
for (size_t i=0; i < nLabels; i++)
{
lexicon_label = lexicon_labels.substr(0, lexicon_labels.find(","));
labels.push_back(lexicon_label);
sort(labels.begin(), labels.end());
remainder = lexicon_labels.substr(lexicon_labels.find(",") + 1, lexicon_labels.length());
lexicon_labels = remainder;
}
}
else
nLabels = 0;
if (f.ext() == "txt") // audacity label format
{
numRegions_ = 0;
mrs_real start, end;
mrs_string label;
regions_.clear();
while (!in.eof())
{
in >> start >> end >> label;
TimeRegion region;
region.start = (mrs_natural) (start * srate_);
region.end = (mrs_natural) (end * srate_);
region.classId = 1;
region.name = label;
mrs_bool label_found = false;
for (unsigned int i=0; i < labels.size(); i++)
{
if (label == labels[i])
{
label_found = true;
region.classId = i;
}
}
if (!label_found)
{
if (lexicon_labels == ",")
{
labels.push_back(label);
sort(labels.begin(), labels.end());
}
}
regions_.push_back(region);
numRegions_ ++;
}
// relabel classIds so that they correspond to sorted labels
for (mrs_natural i=0; i < numRegions_; ++i)
{
mrs_string label = regions_[i].name;
vector<mrs_string>::iterator it = find(labels.begin(), labels.end(), label);
if (it == labels.end())
regions_[i].classId = (mrs_natural)-1;
mrs_natural l = distance(labels.begin(), it);
regions_[i].classId = l;
}
// last region is a duplicate due to empty last line
//.........这里部分代码省略.........