73 const char * lbegin = begin;
74 const char * lend = lbegin;
75 IndexType min_field_id = std::numeric_limits<IndexType>::max();
76 IndexType min_feat_id = std::numeric_limits<IndexType>::max();
77 while (lbegin != end) {
80 while (lend != end && *lend !=
'\n' && *lend !=
'\r') ++lend;
82 const char * p = lbegin;
83 const char * q = NULL;
86 int r = ParsePair<real_t, real_t>(p, lend, &q, label, weight);
94 out->weight.push_back(weight);
96 if (out->label.size() != 0) {
97 out->offset.push_back(out->index.size());
99 out->label.push_back(label);
106 int r = ParseTriple<IndexType, IndexType, real_t>(p, lend, &q, fieldId, featureId, value);
111 out->field.push_back(fieldId);
112 out->index.push_back(featureId);
113 min_field_id = std::min(fieldId, min_field_id);
114 min_feat_id = std::min(featureId, min_feat_id);
117 out->value.push_back(value);
124 if (out->label.size() != 0) {
125 out->offset.push_back(out->index.size());
127 CHECK(out->field.size() == out->index.size());
128 CHECK(out->label.size() + 1 == out->offset.size());
133 if (param_.indexing_mode > 0
134 || (param_.indexing_mode < 0 && !out->index.empty() && min_feat_id > 0
135 && !out->field.empty() && min_field_id > 0) ) {
137 for (IndexType& e : out->index) {
140 for (IndexType& e : out->field) {