20 class CDelimiterTokenizer;
23 template <
class ST>
class SGString;
24 template <
class T>
class SGSparseVector;
40 CCSVFile(FILE* f,
const char* name=NULL);
49 CCSVFile(
int fd,
const char* mode,
const char* name=NULL);
58 CCSVFile(
const char* fname,
char rw=
'r',
const char* name=NULL);
96 virtual void get_vector(int8_t*& vector, int32_t& len);
97 virtual void get_vector(uint8_t*& vector, int32_t& len);
98 virtual void get_vector(
char*& vector, int32_t& len);
99 virtual void get_vector(int32_t*& vector, int32_t& len);
100 virtual void get_vector(uint32_t*& vector, int32_t& len);
104 virtual void get_vector(int16_t*& vector, int32_t& len);
105 virtual void get_vector(uint16_t*& vector, int32_t& len);
106 virtual void get_vector(int64_t*& vector, int32_t& len);
107 virtual void get_vector(uint64_t*& vector, int32_t& len);
119 uint8_t*& matrix, int32_t& num_feat, int32_t& num_vec);
121 int8_t*& matrix, int32_t& num_feat, int32_t& num_vec);
123 char*& matrix, int32_t& num_feat, int32_t& num_vec);
125 int32_t*& matrix, int32_t& num_feat, int32_t& num_vec);
127 uint32_t*& matrix, int32_t& num_feat, int32_t& num_vec);
129 int64_t*& matrix, int32_t& num_feat, int32_t& num_vec);
131 uint64_t*& matrix, int32_t& num_feat, int32_t& num_vec);
133 float32_t*& matrix, int32_t& num_feat, int32_t& num_vec);
135 float64_t*& matrix, int32_t& num_feat, int32_t& num_vec);
137 floatmax_t*& matrix, int32_t& num_feat, int32_t& num_vec);
139 int16_t*& matrix, int32_t& num_feat, int32_t& num_vec);
141 uint16_t*& matrix, int32_t& num_feat, int32_t& num_vec);
153 uint8_t*& array, int32_t*& dims, int32_t& num_dims);
155 char*& array, int32_t*& dims, int32_t& num_dims);
157 int32_t*& array, int32_t*& dims, int32_t& num_dims);
159 float32_t*& array, int32_t*& dims, int32_t& num_dims);
161 float64_t*& array, int32_t*& dims, int32_t& num_dims);
163 int16_t*& array, int32_t*& dims, int32_t& num_dims);
165 uint16_t*& array, int32_t*& dims, int32_t& num_dims);
214 int32_t& max_string_len);
217 int32_t& max_string_len);
220 int32_t& max_string_len);
223 int32_t& max_string_len);
226 int32_t& max_string_len);
229 int32_t& max_string_len);
232 int32_t& max_string_len);
235 int32_t& max_string_len);
238 int32_t& max_string_len);
241 int32_t& max_string_len);
244 int32_t& max_string_len);
247 int32_t& max_string_len);
260 virtual void set_vector(
const int8_t* vector, int32_t len);
261 virtual void set_vector(
const uint8_t* vector, int32_t len);
262 virtual void set_vector(
const char* vector, int32_t len);
263 virtual void set_vector(
const int32_t* vector, int32_t len);
264 virtual void set_vector(
const uint32_t* vector, int32_t len);
268 virtual void set_vector(
const int16_t* vector, int32_t len);
269 virtual void set_vector(
const uint16_t* vector, int32_t len);
270 virtual void set_vector(
const int64_t* vector, int32_t len);
271 virtual void set_vector(
const uint64_t* vector, int32_t len);
282 const uint8_t* matrix, int32_t num_feat, int32_t num_vec);
284 const int8_t* matrix, int32_t num_feat, int32_t num_vec);
286 const char* matrix, int32_t num_feat, int32_t num_vec);
288 const int32_t* matrix, int32_t num_feat, int32_t num_vec);
290 const uint32_t* matrix, int32_t num_feat, int32_t num_vec);
292 const int64_t* matrix, int32_t num_feat, int32_t num_vec);
294 const uint64_t* matrix, int32_t num_feat, int32_t num_vec);
296 const float32_t* matrix, int32_t num_feat, int32_t num_vec);
298 const float64_t* matrix, int32_t num_feat, int32_t num_vec);
300 const floatmax_t* matrix, int32_t num_feat, int32_t num_vec);
302 const int16_t* matrix, int32_t num_feat, int32_t num_vec);
304 const uint16_t* matrix, int32_t num_feat, int32_t num_vec);
375 #endif // #ifndef SWIG
377 virtual const char*
get_name()
const {
return "CSVFile"; }
384 void init_with_defaults();
387 void skip_lines(int32_t num_lines);
403 bool is_data_transposed;
409 int32_t m_num_to_skip;
void set_delimiter(char delimiter)
virtual void get_matrix(uint8_t *&matrix, int32_t &num_feat, int32_t &num_vec)
void set_transpose(bool value)
virtual void set_vector(const int8_t *vector, int32_t len)
virtual void set_matrix(const uint8_t *matrix, int32_t num_feat, int32_t num_vec)
virtual void set_string_list(const SGString< uint8_t > *strings, int32_t num_str)
Class for buffered reading from a ascii file.
void set_lines_to_skip(int32_t num_lines)
int32_t get_stats(int32_t &num_tokens)
Class CSVFile used to read data from comma-separated values (CSV) files. See http://en.wikipedia.org/wiki/Comma-separated_values.
Class for reading from a string.
virtual void get_vector(int8_t *&vector, int32_t &len)
A File access base class.
virtual void get_sparse_matrix(SGSparseVector< bool > *&matrix, int32_t &num_feat, int32_t &num_vec)
all of classes and functions are contained in the shogun namespace
The class CDelimiterTokenizer is used to tokenize a SGVector into tokens using custom chars as ...
virtual void set_sparse_matrix(const SGSparseVector< bool > *matrix, int32_t num_feat, int32_t num_vec)
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry* vector is orde...
virtual const char * get_name() const
virtual void get_string_list(SGString< uint8_t > *&strings, int32_t &num_str, int32_t &max_string_len)
virtual void get_ndarray(uint8_t *&array, int32_t *&dims, int32_t &num_dims)