示例#1
0
static void read_all_lines(const char* file_name, vector<string>& lines) {
  ifstream ifs(file_name);
  if (!ifs) {
    throw converter_exception(string("cannot open: ") + file_name);
  }
  for (string line; getline(ifs, line); ) {
    lines.push_back(line);
  }
}
示例#2
0
static void read_all_lines(const char* file_name, vector<string>& lines) {
  ifstream ifs(file_name);
  if (!ifs) {
    throw JUBATUS_EXCEPTION(converter_exception(string("cannot open: ") + file_name)
        << jubatus::exception::error_file_name(file_name));
  }
  for (string line; getline(ifs, line); ) {
    lines.push_back(line);
  }
}
示例#3
0
static MeCab::Model* create_mecab_model(const char* arg) {
  MeCab::Model* t = MeCab::createModel(arg);
  if (!t) {
    string msg("cannot make mecab tagger: ");
    msg += MeCab::getTaggerError();
    throw JUBATUS_EXCEPTION(converter_exception(msg));
  } else {
    return t;
  }
}