wiseio / paratext

A library for reading text files over multiple cores.
Apache License 2.0
1.06k stars 103 forks source link

How to build the library with no Python #32

Open joa-quim opened 8 years ago

joa-quim commented 8 years ago

Ok, as title says. If I want to build just the lib and no python wrapper how can we do that?

Thanks

wesm commented 8 years ago

I suggest creating a build system with CMake to build a shared library libparatext.so

deads commented 8 years ago

It's a header-only template library so simply include the headers you need.

The CSVColBasedLoader is the main controller class for CSV loading. For example, to load a CSV file myfile.csv and copy the contents of the first column, which is assumed categorical, do:

#include <vector>
#include "csv/colbased_loader.hpp"

int main(int argc, char **argv) {
     ParaText::CSV::ColBasedLoader loader;
     ParaText::ParseParams params;
     params.num_threads=1;
     loader.load("myfile.csv", params);

     // Now, just grab the first column, which we assume to be categorical.
     std::vector<size_t> col_data;
     auto inserter = std::back_inserter(col_data);
     loader.copy_column<decltype(inserter), size_t>(0, inserter);
     auto levels = loader.get_levels();
     return 0;
}

HTH. A C++ tutorial and reference guide is in our medium-term roadmap.

wesm commented 8 years ago

It might be nice to add a makefile for installing the headers into a particular toolchain location