| 43 | } |
| 44 | |
| 45 | int GetLabelIdxForTSV(const std::string& str, int num_features, int label_idx) { |
| 46 | if (num_features <= 0) { |
| 47 | return label_idx; |
| 48 | } |
| 49 | auto str2 = Common::Trim(str); |
| 50 | auto tokens = Common::Split(str2.c_str(), '\t'); |
| 51 | if (static_cast<int>(tokens.size()) == num_features) { |
| 52 | return -1; |
| 53 | } else { |
| 54 | return label_idx; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | int GetLabelIdxForCSV(const std::string& str, int num_features, int label_idx) { |
| 59 | if (num_features <= 0) { |
no test coverage detected