Read text data from file.
More...
#include <text_reader.h>
|
| TextReader (const char *filename, bool is_skip_first_line) |
| Constructor.
|
|
| ~TextReader () |
| Destructor.
|
|
void | Clear () |
| Clear cached data.
|
|
std::string | first_line () |
| return first line of data
|
|
std::vector< std::string > & | Lines () |
| Get text data that read from file.
|
|
INDEX_T | ReadAllAndProcess (const std::function< void(INDEX_T, const char *, size_t)> &process_fun) |
|
INDEX_T | ReadAllLines () |
| Read all text data from file in memory.
|
|
std::vector< char > | ReadContent (size_t *out_len) |
|
INDEX_T | SampleFromFile (Random &random, INDEX_T sample_cnt, std::vector< std::string > *out_sampled_data) |
|
INDEX_T | ReadAndFilterLines (const std::function< bool(INDEX_T)> &filter_fun, std::vector< INDEX_T > *out_used_data_indices) |
| Read part of text data from file in memory, use filter_fun to filter data.
|
|
INDEX_T | SampleAndFilterFromFile (const std::function< bool(INDEX_T)> &filter_fun, std::vector< INDEX_T > *out_used_data_indices, Random &random, INDEX_T sample_cnt, std::vector< std::string > *out_sampled_data) |
|
INDEX_T | CountLine () |
|
INDEX_T | ReadAllAndProcessParallelWithFilter (const std::function< void(INDEX_T, const std::vector< std::string > &)> &process_fun, const std::function< bool(INDEX_T, INDEX_T)> &filter_fun) |
|
INDEX_T | ReadAllAndProcessParallel (const std::function< void(INDEX_T, const std::vector< std::string > &)> &process_fun) |
|
INDEX_T | ReadPartAndProcessParallel (const std::vector< INDEX_T > &used_data_indices, const std::function< void(INDEX_T, const std::vector< std::string > &)> &process_fun) |
|
template<typename INDEX_T>
class LightGBM::TextReader< INDEX_T >
Read text data from file.
◆ TextReader()
template<typename INDEX_T >
Constructor.
- Parameters
-
filename | Filename of data |
is_skip_first_line | True if need to skip header |
◆ Lines()
template<typename INDEX_T >
Get text data that read from file.
- Returns
- Text data, store in std::vector by line
◆ ReadAllLines()
template<typename INDEX_T >
Read all text data from file in memory.
- Returns
- number of lines of text data
◆ ReadAndFilterLines()
template<typename INDEX_T >
INDEX_T LightGBM::TextReader< INDEX_T >::ReadAndFilterLines |
( |
const std::function< bool(INDEX_T)> & |
filter_fun, |
|
|
std::vector< INDEX_T > * |
out_used_data_indices |
|
) |
| |
|
inline |
Read part of text data from file in memory, use filter_fun to filter data.
- Parameters
-
filter_fun | Function that perform data filter |
out_used_data_indices | Store line indices that read text data |
- Returns
- The number of total data
The documentation for this class was generated from the following file:
- External/LightGBM_2.2.3/LightGBM-2.2.3/include/LightGBM/utils/text_reader.h