12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #include "sekai/UnisynIndex.h"
- #include <fstream>
- #include <iostream>
- #include <sstream>
- #include <boost/algorithm/string/classification.hpp>
- #include <boost/algorithm/string/split.hpp>
- #include <boost/lexical_cast.hpp>
- bool UnisynIndex::readFromFile(std::string fileName) {
- std::ifstream infile(fileName);
- bool header = true;
- std::string line;
- while (std::getline(infile, line)) {
- if (line == "EST_Header_End")
- header = false;
- else {
- std::vector<std::string> spl;
- boost::split(spl, line, boost::is_any_of("\t "),
- boost::token_compress_on);
- if (header) {
- headerMap[spl[0]] = spl[1];
- } else {
- PhoInfo p;
- p.basename = spl[1];
-
- for(int i=2;i<spl.size();i++)
- {
- p.alignment.push_back(boost::lexical_cast<float>(spl[i]));
- }
-
- phoMap[spl[0]] = p;
- }
- }
- }
- return true;
- }
- //Pitch Track::pitchEmpty = {0};
|