int main() { load_feature("../txt/train_punctuation.txt", train_punctuation, train_size); load_feature("../txt/test_punctuation.txt", test_punctuation, test_size); load_label("../txt/train_label.txt", train_label, train_size); load_label("../txt/test_label.txt", test_label, test_size); bayes_train(train_punctuation, train_label, train_size, p_y, p_xy); bayes_test(test_punctuation, test_label, test_size, p_y, p_xy); save_label("./predict.txt", test_label, test_size); return 0; }
/** * a_babel_init: * * Initialises babel module. * Mainly check existence of gpsbabel progam * and load all features available in ths version. */ void a_babel_init () { /* TODO allow to set gpsbabel path via command line */ gpsbabel_loc = g_find_program_in_path( "gpsbabel" ); if ( !gpsbabel_loc ) g_critical( "gpsbabel not found in PATH" ); // Unlikely to package unbuffer on Windows so ATM don't even bother trying // Highly unlikely unbuffer is available on a Windows system otherwise #ifndef WINDOWS unbuffer_loc = g_find_program_in_path( "unbuffer" ); if ( !unbuffer_loc ) g_warning( "unbuffer not found in PATH" ); #endif load_feature (); }
/** * a_babel_post_init: * * Initialises babel module. * Mainly check existence of gpsbabel progam * and load all features available in that version. */ void a_babel_post_init () { // Read the current preference const gchar *gpsbabel = a_preferences_get(VIKING_PREFERENCES_IO_NAMESPACE "gpsbabel")->s; // If setting is still the UNIX default then lookup in the path - otherwise attempt to use the specified value directly. if ( g_strcmp0 ( gpsbabel, "gpsbabel" ) == 0 ) { gpsbabel_loc = g_find_program_in_path( "gpsbabel" ); if ( !gpsbabel_loc ) g_warning( "gpsbabel not found in PATH" ); } else gpsbabel_loc = g_strdup ( gpsbabel ); // Unlikely to package unbuffer on Windows so ATM don't even bother trying // Highly unlikely unbuffer is available on a Windows system otherwise #ifndef WINDOWS unbuffer_loc = g_find_program_in_path( "unbuffer" ); if ( !unbuffer_loc ) g_warning( "unbuffer not found in PATH" ); #endif load_feature (); }