Beispiel #1
0
int main() {
	load("./txt/train.txt", train_literals, train_clicks, true);
	load("./txt/test.txt", test_literals, test_clicks, false);
	load_dictionary("./txt/punctuation.txt", dictionary);
	save_vector("./txt/train_punctuation.txt", train_literals, dictionary);
	save_vector("./txt/test_punctuation.txt", test_literals, dictionary);
	save_label("./txt/train_label.txt", train_clicks);
	save_label("./txt/test_label.txt", test_clicks);
	return 0;
}
Beispiel #2
0
static
named_label(name, is_defn) {
    if ( save_label( name, 0 ) )
        return set_label( name, new_label() );
    else
        return get_label( name );
}
Beispiel #3
0
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;
}
Beispiel #4
0
int valid_label(char *s)
{
    if (s[2] != '\0')
        {
        if (check_label(&s[2]))
            return(1);

        save_label(&s[2]);
        return(0);
        } /* end if. */

    return 0; /* empty string is not a valid label, or is it??? */

} /* end valid_label. */
Beispiel #5
0
void do_cmdline(int ac, char *av[])
{
    int i;

    for (i=1;i<ac;i++)
        {
        if (valid_drive((av[i])=strupr(av[i])))
            {
            if (*Drive == '?')
                {
                *Drive = *av[i];        /* Save the drive letter. */
                } /* end if. */
            else
                {
                myprintf("There were multiple drives mentioned.\r\n",0);
                myprintf("Please select one drive to label at a time.\r\n",0);
                exit(26);
                } /* end if. */

            /* See if the drive letter is the first parameter. */
            if (i != 1)
                DriveNotFirst = 1;

            /* See if the label is tacked right onto the drive letter. */
            /* Verify label if it is. */
            if (valid_label(av[i]))
                return;

            } /* end if. */
        else
            {
            if (check_label(av[i]))
                return;
            else
                save_label(av[i]);

            } /* end else. */

        } /* end for. */

    if (check_quotes())
        {
        strcpy(Label,"");
        myprintf("Invalid label\r\n",0);
        return;
        } /* end if. */

} /* end process_cmdline. */
int main_widget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWorkspace::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: resize_s(); break;
        case 1: push_right(); break;
        case 2: push_left(); break;
        case 3: mark_selection(); break;
        case 4: open_new_file(); break;
        case 5: set_font(); break;
        case 6: set_page((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: set_background(); break;
        case 8: save_label(); break;
        default: ;
        }
        _id -= 9;
    }
    return _id;
}